- Exercise-1: Echoing words in Java
- Exercise 2: Inputting and Echoing integer and string entered by user
- Exercise-3: How to use If Statement in Java Programming
- Exercise-4: How to Use If-ElseStatement in Java Programming
- Exercise-5: Using Multi If and Else Statement in Java Programming
- Exercise-6: Write a program which will represent the entire relational operators in Java Programming.
- Exercise-7: Write a program to demonstrate the logical operators in Java.
- Excercise-8: Write a Program Using Conditional Operator.
- Exercise-9: Java Exercise of IF and SWITCH
- Exercise-10: Java Exercise of While, Do-While and For Loop
- Exercise-11: Java Misc. Excercise(1-10)
- Exercise-11: Java Misc. Exercise(11-19)
- Exercise-11: Java Misc. Exercise(20-25)
Showing posts with label while. Show all posts
Showing posts with label while. Show all posts
Friday, February 8, 2013
Excercise between W1 and W3
Week-3: 3.6: While
While:
Another type of loop you can use in Java is called the while loop. While loops are a lot
easier to understand than for loops. Here's what they look like:
while ( condition ) {
}
So you start with the word "while" in lowercase. The condition you want to test for goes
between round brackets. A pair of curly brackets comes next, and the code you want to
execute goes between the curly brackets. As an example, here's a while loop that prints
out some text (Try the code out for yourself):
int loopVal = 0;
while ( loopVal < 5) {
System.out.println("Printing Some Text");
loopVal++;
}
Another type of loop you can use in Java is called the while loop. While loops are a lot
easier to understand than for loops. Here's what they look like:
while ( condition ) {
}
So you start with the word "while" in lowercase. The condition you want to test for goes
between round brackets. A pair of curly brackets comes next, and the code you want to
execute goes between the curly brackets. As an example, here's a while loop that prints
out some text (Try the code out for yourself):
int loopVal = 0;
while ( loopVal < 5) {
System.out.println("Printing Some Text");
loopVal++;
}
Visit For Details
Subscribe to:
Posts (Atom)