Chapter 6

2 Pages
83 Views

Department
Information Technology Management
Course Code
ITM 200
Professor
Vikraman Baskaran

This preview shows 80% of the first page. Sign up to view the full 2 pages of the document.
Description
Khushi Sharma Thursday May 17 , 2012 Chapter 6 Repetition Using Loops A Problem The While Loop Statement – Details -syntax of the Java while loop statement is as follow: while () -while is a Java reserved word, which tells the complier that this a while loop statement -the is a Boolean expression -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  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 Infinite Loops -in order for the loop to end, the condition must become false, the following loop will not end -it will print for an infinite number of times because we have no value to the ‘x’ inside the bracket -adding x—above fixes the problem Block Statements in Loops -curly braces are required to enclose block statements in the while loop Sentinel Controlled Loops: -this form is used when we want the program to input a series of data it
More Less
Unlock Document

Only 80% of the first page are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit