• Post Reply Bookmark Topic Watch Topic
  • New Topic

char data type and Unicode  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 22967
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They can be put into String literals as well:


 
Rancher
Posts: 1002
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Unicode value is simply an integral value. All these work:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!