• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unicode Literal

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

'3b1' is the hex value for the Greek letter alpha in the Unicode.
Write the Unicode literal which can be used to initialize a char variable to alpha.
(Just write what should replace uuuuuu in the following statement?
char alpha = 'uuuuuu' ; )




Please Explain your answer.
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A character can be initialized using the Unicode format as follows:
char myChar = '\uxxxx';
The \u makes it clear that you're using Unicode format and the xxxx is the (four character) hex representation of the char value.
For example, if you're using the value 2fc5, you would do:
char myChar = '\u2fc5';
Now can you do that for your question? Please post your answer.
Also, can you do it directly? myChar = 3b1? Why/why not?
HTH,
Sashi
[ December 14, 2005: Message edited by: Sasikanth Malladi ]
 
Shalini Banerjee
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnx shahi,

now got it.
The answer will be

/u03b1 or /u03B1
[ December 14, 2005: Message edited by: Shalini Banerjee ]
 
Sasikanth Malladi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome!
BUT it should be a BACKSLASH as in '\' and NOT a FORWARD SLASH as in '/' and should be delimited by single quotes '\uxxxx'.
Also, it'll work without the single quotes (in your case). Do you know why? Also do you know in what other cases it might not work?
Further reading:
ShashiJLS char specification

[ December 14, 2005: Message edited by: Sasikanth Malladi ]
[ December 14, 2005: Message edited by: Sasikanth Malladi ]
reply
    Bookmark Topic Watch Topic
  • New Topic