• 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

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
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic