I have a question
when I have a program like below
claa MyHelloWorld{
public static void main(String args[]){
While(false){
System.out.println("This is in False statement);}
}
}
When I execute the above Program it is giving the Compilation Error
Unreachable statement.
but when I slightly modify the program like this
claa MyHelloWorld{
public static void main(String args[]){
//Here I changed from true to false
While(true){
System.out.println("This is in False statement);}
}
}
Can you explain me why the First one is giving the Compilation and the Second one is working ?
Thanks
when I have a program like below
claa MyHelloWorld{
public static void main(String args[]){
While(false){
System.out.println("This is in False statement);}
}
}
When I execute the above Program it is giving the Compilation Error
Unreachable statement.
but when I slightly modify the program like this
claa MyHelloWorld{
public static void main(String args[]){
//Here I changed from true to false
While(true){
System.out.println("This is in False statement);}
}
}
Can you explain me why the First one is giving the Compilation and the Second one is working ?
Thanks