Posts Tagged tutorial 4
Java Tutorial 4 – Looping
I think you guys can do following:
- create new class
- now add following lines in main method
no need to import anything because we are not using scanner here.
Syntax:
while ( condition ) {
….to do …
}
it will first check the condition and if condition is true it run the code within the {} and again check the condition, this will continue till condition will not become false. Once it become false loop is ended.
we created here an int i and printed 1 line each time it loops.
and If u know C/C++ its going to boring for you ! because its same.
Again Doubts and suggestions are invited.
Peace.
