• 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 value of char

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

Why line 1 and 2 compile well? I only know there're 2 ways to represent a char, one is enclosing a char in single quote, like 'x', the other is to using unicode value specified using four hexadecimal digits, preceded by \u. While '101' doesn't fell in these 2. Are there any other ways to define a char?
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When specifying the character literal as '\...' the dots must be replaced by an octal number, that is the first digit must be between 0 and 3 and the other two digits between 0 to 7. The legal range is '\000' to '\377' (i.e. decimal 0 to 255)
See JLS sections
JLS 3.10.4 Character Literals
JLS 3.10.6 Escape Sequences for Character and String Literals
[ November 01, 2002: Message edited by: Valentin Crettaz ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic