File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Unicode Representation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unicode Representation" Watch "Unicode Representation" New topic
Author

Unicode Representation

sr shashidhar
Greenhorn

Joined: Jan 17, 2013
Posts: 27
Hi frnds,






My question is how we are getting 8 and 56 for '\u0038'...?


thanks in advance
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
I trust you know that 38hex means 56dec?
So your compiler goes through the code, and converts all your Unicode escapes to displayed characters. Your \u0038 becomes 8 and your '\u0038' becomes '8'. That is done before you compile anything. I presume you can work out how 8f becomes 8.0 and how '8' becomes 56, now.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 866
    
    5
(too slow - deleted)

Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2165
    
  47
The unicode character \u0038 is '8' so in the first case the value 8 is assigned to the variable. In the second case you are assigning the char with a value of \u0038. This is a Hex value which when converted to decimal is 56.

Edit: Even slower
sr shashidhar
Greenhorn

Joined: Jan 17, 2013
Posts: 27

Now i got.
Thanks Campbell Ritchie , Tony Docherty
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
You’re welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unicode Representation
 
Similar Threads
unicode
float f= \u0038
static method calling
formatting using printf
switch case