This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Associate Certification (OCAJP 7) and the fly likes char data type and Unicode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7)
Bookmark "char data type and Unicode" Watch "char data type and Unicode" New topic
Author

char data type and Unicode

Glenn Gould
Greenhorn

Joined: Jul 09, 2013
Posts: 5
In Java, is char the only data type that Unicode can be assigned to?

For example,

char d = '\u003E';

Can the Unicode characters on the R.H. side of the assignment be assigned to another data type?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

They can be put into String literals as well:


Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 867
    
    5
A Unicode value is simply an integral value. All these work:

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: char data type and Unicode