• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Regarding 'char'

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one help me in finding more about this..

i had a question like whether the following is poosible...

char c = \u0022;
this raises a compiler error... but i came to know this later only bcoz
when i was studying about char i was tryin something like this...

char c = \u0030;
it accepted til \u0039 without any single quotes...
what range is this actually...
something which ever i tried without '' other than this range raises an error... i whant to know if there is any another such range like this...
when i print it on the cosole it prints just '.' for all the literal from \u0030 to \u0039...
plz help me on this...
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unicode 0030 to 0039 correspond to numbers from 0 to 9.

So char c = \u0030; is same as char c = 0x0000; (which means set the Ascii code 0 into c) That is why you it can compile, and that is also why printing it out will display garbage.
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic