This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JQ+ QUESTION . Pls help!!!!

 
kaushik banerjee
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
JQ+ 952739446690
Which of the foll are invalid?
a) char b='\u0062'
b) char \u0062='b'
c)ch\u0061r b='b'
d)char lf='\u000a' \\ '\u000a' represents linefeed
JQ+ says only 1,3 are correct . 4 is not .It states " Though \u000a represents a line feed it is translated to a line feed in the first parse so it puts a line feed wherever it occurs. In
this case we should use escape sequence : char lf = '\n';
why is it then that we cannot represent it by a unicode value. Is there any rule that sequences like \n,\t,\b etc can't be represented in unicode?
Thx in advance
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3713
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason is such unicode sequences convert to the actual chars before the compilation takes place so
char lf='\u000a'; this is is equivalant to:
char lf='
';

BTW, 2 is also correct. The s/w shows that correctly.
-Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new Pattern)
www.enthuware.com/jqplus

Your guide to SCJD exam!
www.enthuware.com/jdevplus
Try out the world's only WebCompiler!
www.jdiscuss.com

[This message has been edited by Paul Anil (edited May 17, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic