I've studied with the OCA/OCP JAVA SE 7 (Kathy Sierra, Bert Bates) book and i've done all the standard test (except the last-day one) from enthuware. I'm now taking the two exams from the CD-rom that comed with the book, and some question was a bit tricky. Maybe it will be good to add these in the enthuware bank ?
1) Coud you please tell me why this code will compile as is ? Even if the line B is unreachable.
However, if we remove the comment A, the code will not compile because line A is unreachable. I don't understand why the compiler behaves differently here.
Code: Select all
public static void main(String args[]){
int k = 2;
outer:
while(true){
++k;
inner:
for(int j = 5; j > 2; j--){
if(j==3)
continue inner;
break outer;
//System.out.println(k); // A
}
System.out.println(k); // B
continue outer;
}
System.out.println(k);
}
i don't find anything about octal number ".". It seems that if we have a "." in an octal number, the 0 is ignored and the number is treated as a decimal. Where can I find doc about this behavior ?
Code: Select all
double a = 09.4; // compile
double b = 094; // Error. 9 is not an octal digit