ITM 200 Lecture Notes - Object-Oriented Programming, Structured Programming, Reserved Word

105 views2 pages

Document Summary

Syntax of the java while loop statement is as follow: While is a java reserved word, which tells the complier that this a while loop statement. The is an java statement known as the body of the loop. The while loop is a pre-test loop which means it will test the value of the condition prior to executing the loop while () Pre-test loop means that it will check first and if the statement is true then it will evaluate it. Need to be careful to set the condition false somewhere in the loop so that the loop will end. Loops that do not end are called infinite loops. While loops executes 0 or more times, if the condition is false the loop will not execute. In order for the loop to end, the condition must become false, the following loop will not end.