This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is the range of primitive char? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is the range of primitive char?" Watch "What is the range of primitive char?" New topic
Author

What is the range of primitive char?

Kelvin Mak
Ranch Hand

Joined: Oct 04, 2002
Posts: 51
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?


SCJP1.4
Jamal Hasanov
Ranch Hand

Joined: Jan 08, 2002
Posts: 411
0 - 2^16
Regards,
Jamal Hasanov
www.j-think.com
Poornachandran R
Ranch Hand

Joined: Sep 11, 2002
Posts: 47
I think it is 0 to ((2^16)-1)
Regards,
Poornachandran
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Those kind of information can be found in the JLS at:
JLS 4.2.1 Integral Types and Values


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
david eberhardt
Ranch Hand

Joined: Jul 02, 2002
Posts: 158
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

Joined: Nov 11, 2002
Posts: 4
unsigned 16 bits
Kelvin Mak
Ranch Hand

Joined: Oct 04, 2002
Posts: 51
thx all!
 
Don't get me started about those stupid light bulbs.
 
subject: What is the range of primitive char?