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
what is the difference between Object Based Language and Object Oriented Language?
Write a program in java to calculate the difference between the sum of the odd level and even level nodes of a binary tree.
What is the basic concept of java?
What are the advantages of defining packages in java?
Why is java called the platform independent programming language?
How can you read content from file in java?
Can a singleton class be inherited?
What is the finalize method do?
For class CFoo { }; what default methods will the compiler generate for you>?
What does the string method compareto () do?
can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread
Differentiate between stringbuffer and stringbuilder in java.
Explain importance of inheritance in java?
What is output buffer?
What is the base class for error and exception?