File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes range of char 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 "range of char" Watch "range of char" New topic
Author

range of char

antraarora
Ranch Hand

Joined: Jul 27, 2000
Posts: 45
What is the range of char??? What is the numerical range of char??? Is numerical range and 'range' the same thing/
Aru
Ranch Hand

Joined: Jul 20, 2000
Posts: 112
'u0000' to 'uffff'
antraarora
Ranch Hand

Joined: Jul 27, 2000
Posts: 45
What is numerical range then? Chars are always unicode 16bit? Does that mean numerical range is 16?
Surya B
Ranch Hand

Joined: May 10, 2000
Posts: 98
The range of char is 0 to 65535.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
it is also sometimes expressed:
0 to 2^16
Surya B
Ranch Hand

Joined: May 10, 2000
Posts: 98
It is 0 to 2^16-1,not 0 to 2^16.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Sorry for the mistake, I write faster than I think some times.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Why the following are not compilied:
char c='\u000a';char c='\u000A';
but char c='\u000b' char c='\u000f' working.
thanks
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Here is what The Java Language Specification (Chapter3) said:
"Because Unicode escapes are processed very early, it is not correct to write '\u000a' for a character literal whose value is linefeed (LF); the Unicode escape \u000a is transformed into an actual linefeed in translation step 1 (�3.3) and the linefeed becomes a LineTerminator in step 2 (�3.4), and so the character literal is not valid in step 3. Instead, one should use the escape sequence '\n' (�3.10.6). Similarly, it is not correct to write '\u000d' for a character literal whose value is carriage return (CR). Instead, use '\r'. "
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: range of char