> Loops in java?

Loops in java?

Posted at: 2014-12-18 
There are basically 2 kinds of loops.

Task one: There are plates in the kitchen. Bring one to the dining room. Go back to the kitchen. Are there plates left in the kitchen? If yes, bring one to the dining room. Go back to the kitchen, etc.

The "go back" is a loop.

And the test (Are there plates left in the kitchen) is a way to terminate the loop so it doesn't go on forever.

Task two:There are plates in the kitchen. Bring one to the dining room. Are there now 4 plates in the dining room? If not, go back to the kitchen and bring back another plate.

Here the loop is counting instead of bring back all the plates.

Repetition is the essence of a loop. It either continues until some condition is met, or until a count is reached. (But a count being reached is simply one type of condition).

If you still don't understand how loops work, then you need to figure out WHY you don't understand.

Perhaps you just find the syntax to be intimidating.

hello guys.... i have an examination on loops.... but the questions are really hard... i dont really know how loops work(all of them)

the questions are like printing the palindrom nos. finding the prime nos. and all that kinds of questions. help will be appreciated.