A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Why char is unsigned?
Joined: May 09, 2005
Dec 26, 2005 02:13:00
Among all the primitives- only char is un-signed. Why???
Also Pls explain more about signed and unsigned concepts.
Joined: Nov 24, 2005
Dec 26, 2005 02:27:00
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
All roads lead to JavaRanch
Joined: Aug 31, 2004
Dec 26, 2005 21:20:00
Originally posted by Ja vardhan:
... Also Pls explain more about signed and unsigned concepts...
[ 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."
It is sorta covered in the
JavaRanch Style Guide
subject: Why char is unsigned?
Problem returning a byte (was:Why it gives Compiler error?)
Cast byte to char
calling method ----doubt
Conversion between char and short ?
is char unsigned 16 bit?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015