File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes char c='\101'; ..? 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 "char c= Watch "char c= New topic

char c='\101'; ..?

Prashant Neginahal
Ranch Hand

Joined: Dec 04, 2002
Posts: 76
char c='\101';
Here, how '\101' is in octal form and its decimal value is coming as 65...?
Hope someone will help..

--------------<br />Prashant<br />SCJP-91%
James Chegwidden
Ranch Hand

Joined: Oct 06, 2002
Posts: 201
Are you sure that's octal- octal starts with a 0 and hex 0x or 0X

Author and Instructor, my book
Sarma Lolla
Ranch Hand

Joined: Oct 21, 2002
Posts: 203
Yes. This is in octal format. A char can be assigned a value either in octal format or unicode format.
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

Check out the JLS, it explains �3.10.6 Escape Sequences for Character and String Literals:
\ OctalDigit
\ OctalDigit OctalDigit
\ ZeroToThree OctalDigit OctalDigit
OctalDigit: one of
0 1 2 3 4 5 6 7
ZeroToThree: one of
0 1 2 3
I agree. Here's the link:
subject: char c='\101'; ..?
It's not a secret anymore!