This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

From Dan's exam

 
Damien Howard
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can read the format of the octal escapes in JLS 3.10.6
[ July 06, 2003: Message edited by: Jose Botella ]
 
Brian Joseph
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Damien Howard
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic