Originally posted by Ben Gao:
public class Question38 {
public static void main(String[] args){
while(false);//line 1
if(false);//line 2
do{}while(false);//line 3
for(;false ; ) ;//line 4
}
}
This code compiles and runs fine,but the answer is "Compilation error on lines 1 and 4.".
Is it correct?
Thank you!
Ben,
I tried to compile your code as it is & the result:
Question38.java:6: ')' expected
for(;false ; //line 4
^
2 errors
Once change the code flaged by compiler with
for (;false ; ) ; <- the correct way.
everything runs OK even nothing got printed.
[ February 27, 2002: Message edited by: Valentin Crettaz ]