package Example1;
public class DoWhileExample {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i=10;
do{
System.out.println(i);
}while(i>10);
}
}
output:10
In the above example the do block is executed irrespective of whether the while condition is true or false. if the same scenario was used for while loops then nothing is printed in the console reason the while condition is false. >>>Local Variable vs Class Variable
------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment