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

Why char is unsigned?

Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169

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


Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

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

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
I agree. Here's the link:
subject: Why char is unsigned?
It's not a secret anymore!