It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is this" Watch "What is this" New topic
Author

What is this

Bob Young
Ranch Hand

Joined: Dec 23, 2000
Posts: 65
class Test {
static char c = '\u0041'; // unicode, prints A
// char c = 65 decimal, prints A
// char c = 0101 octal, prints A
// char c = '\101' ?, prints A
public static void main (String[] args) {
System.out.println(c);
}
}

I have not seen a character defined as '/101'. What is it? It acts like octal, but does not have the leading 0 and it is in single quote. If I use and octal number, I do not need the single quote. 0101 (octal) is 65 decimal.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
See here


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is this
 
It's not a secret anymore!