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 Why char is unsigned? 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 "Why char is unsigned?" Watch "Why char is unsigned?" New topic
Author

Why char is unsigned?

Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Friends,

Among all the primitives- only char is un-signed. Why???
Also Pls explain more about signed and unsigned concepts.

Thanks.


Javardhan:
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Why would you want a character to be signed ? After all, the ascii/Unicode tables are not signed. If you'd like to use two bytes signed variables, you could use 'short'.

I don't think you need to ask 'why is it like this/ like that ?'. For example., "Why is a character variable called 'char' ? They could have called it 'bob'"

Just remember that char variables are unsigned, and other are signed


[My Blog]
All roads lead to JavaRanch
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Ja vardhan:
... Also Pls explain more about signed and unsigned concepts...

See this thread.
[ December 26, 2005: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why char is unsigned?