answersLogoWhite

0

Java has three kinds of loops

1. For Loop

2. While Loop

3. Do - While Loop

Both For loop and While loop would iterate through a certain lines of code within the loop's limit as long as the loop condition is satisfied.

A do while loop would execute the loop once even before checking the condition. So in a do while loop, even if the loop condition is not satisfied the loop would execute once.

Example Declarations:

for(int i = 0; i < n; i++) {

.....

}

while (i < n) {

...

i++;

}

do {

...

i++;

} while (i < n) ;

User Avatar

Wiki User

16y ago

Still curious? Ask our experts.

Chat with our AI personalities

JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
More answers

A Loop in java is a programming construct that allows you to repeat a certain piece of code multiple times based on some condition. You may want to check out the name of every student in a class and print out only those that start with an "A". In such a case you will use a loop.

The different types of loops available in Java are:

  • While loop
  • Do-while loop
  • Normal For Loop
  • Enhanced For Loop
User Avatar

Wiki User

13y ago
User Avatar

the loop in java is menly for types of loop1)while

2)do while

3)for

4)foreach

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: What are various loops available in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp