What are the types of loops in Java, and how are they used?

Answer Posted / nashiinformaticssolutions

• In Java, for loops are used to repeatedly run statements for a specified number of times. When a programmer knows how many times to run a statement, they use a for loop.
•When some statements must run continuously until a condition is met, the while loop can be helpful. Before statements are executed in while loops, the condition is checked.
•With the exception of checking the condition after a block of statements has been executed, the do while loop is identical to the while loop. Do while loop statements should also run at least once.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we catch more than one exception in single catch block?

841


What is the benefit of abstract class?

710


What is main function purpose?

750


Why is string class considered immutable?

812


What is java objectoutputstream?

748


What is sortedmap interface?

772


What are some characteristics of interference class?

757


What does singleton class mean?

728


Is simpledateformat safe to use in the multithreaded program?

740


What is static import in java?

725


what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????

2017


What is diamond operator in java?

713


Which eclipse is best for java?

739


How do you do descending order in java?

750


Is java se free?

710