[Logo]
Forums Register Login
From Dan's exam
Can someone please explain why or how 2 and 3 are considered in octal format?

Question 7
class D {
public static void main (String[] args) {
char a = 061; // 1
char b = '\61'; // 2
char c = '\061'; // 3
char d = 0x0031; // 4
char e = '\u0031'; // 5
System.out.print(""+a+b+c+d+e);
}
}

Thank you.
You can read the format of the octal escapes in JLS 3.10.6
[ July 06, 2003: Message edited by: Jose Botella ]
Didn't know about those, but I have a feeling that would be a bit too esoteric for the exam itself, but still interesting to know.
Perhaps it isn't on the exam, but it is tough to know, as all the mock exams seem to include a few items that aren't on the exam, at least so people say. Since I haven't taken it yet I'm paranoid as to what will really be on the exam and how hard the real questions are.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 19, 2017 14:54:40.