Help coderanch get a
new server
by contributing to the fundraiser
  • 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

khailds question on char declaration

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
accordin to khalids book , in chp 2 Q2.5 it says
which r valid declarations ??
select all valid answers..
a. char a='\u0081';
b. char \u0061='a';
c. ch\u0061r='a';
it says all answers r valid.
i understood the a answer
can u declare a char variable like in b and c options above.
i thgt variable names could not contain \.
pls throw some light on this .
thx
Kamal
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there,
yeah, the Unicode characters can appear in the source code.
like:
ch\u0061r a = 'a'; => char a = 'a';
char \u0062 = 'b'; => char b = 'b';
char c = '\u0063'; => char c = 'c';
you can also check Velmurugan Periasamy's webside.. check the FAQ or mocklist from javaranch's website, also back to p.24~25 from Khalid Table 2.7.
hope this help. good day.
martha
 
reply
    Bookmark Topic Watch Topic
  • New Topic