aspose file tools*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why char is unsigned?