File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the range of primitive char?

 
Kelvin Mak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot find the primitive range of char in many books, just know the char is a unsigned number, cannot be negative. Anyone knows what is the range of char?
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
0 - 2^16
Regards,
Jamal Hasanov
www.j-think.com
 
Poornachandran R
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is 0 to ((2^16)-1)
Regards,
Poornachandran
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those kind of information can be found in the JLS at:
JLS 4.2.1 Integral Types and Values
 
david eberhardt
Ranch Hand
Posts: 158
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kelvin Michael:
I cannot find the primitive range of char in many books, just know the char is a unsigned number, cannot be negative. Anyone knows what is the range of char?

From the book "Java 2, Sun Certified programmer for Java 2" 2nd Edition, Syngress/Osborne (Exam 310-025) :
pg.30 - "Characters run from \u0000 to \uffff, or
0 to 65,535 or 0 to (2^16)-1.
(note: 2^16 = 65,536 characters representable)
[ November 11, 2002: Message edited by: david eberhardt ]
[ November 11, 2002: Message edited by: david eberhardt ]
 
super peter
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unsigned 16 bits
 
Kelvin Mak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx all!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic