Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes decimal value for Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "decimal value for "ffff" is 69904" Watch "decimal value for "ffff" is 69904" New topic
Author

decimal value for "ffff" is 69904

Siva kandasamy
Ranch Hand

Joined: Dec 31, 2002
Posts: 139
Hi there,
Please look at the code.
If I uncomment at variable "d", I do get compilation error.
Can you tell me why ?
My understanding is, decimal value for "ffff" is 69904.
Therefor I don't see any difference between variable c and d.
Please forgive my ignorance.

thanks
siva
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

0xFFFF is 65535, not 69904. 69904 is thus somewhat larger than the largest possible char value -- hence the compile error.


[Jess in Action][AskingGoodQuestions]
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
0xffff == 65535 == Character.MAX_VALUE
Decimal value of a hex number can be found by adding the product of each hex digit multiplied by 16^(position), as such:

hth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: decimal value for "ffff" is 69904