The while structure is a kind of repetition that defines the conditions at the beginning of the block.
That means if the conditions are not met, then the process will not be repeated.
Written before writing the initialization process while the structure it self, where as
iteration will be written in the block.
The following formats writing:
initialization
while (condition) {
/ / statement that will be repeated
...
iteration
}
Example Program check now
//program
class DemoWhile1{
public static void main(String[] args) {
int i=0;
while(i<10){
System.out.println("I like Java...");
i++;
}
}
}
That means if the conditions are not met, then the process will not be repeated.
Written before writing the initialization process while the structure it self, where as
iteration will be written in the block.
The following formats writing:
initialization
while (condition) {
/ / statement that will be repeated
...
iteration
}
Example Program check now
//program
class DemoWhile1{
public static void main(String[] args) {
int i=0;
while(i<10){
System.out.println("I like Java...");
i++;
}
}
}
No comments:
Post a Comment