File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JQ+ QUESTION . Pls help!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JQ+ QUESTION . Pls help!!!!" Watch "JQ+ QUESTION . Pls help!!!!" New topic

JQ+ QUESTION . Pls help!!!!

kaushik banerjee
Ranch Hand

Joined: Mar 11, 2001
Posts: 56
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

Joined: Sep 23, 2000
Posts: 3634
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.
Get Certified, Guaranteed!
(Now Revised for the new Pattern)

Your guide to SCJD exam!
Try out the world's only WebCompiler!

[This message has been edited by Paul Anil (edited May 17, 2001).]

Enthuware - Best Mock Exams and Questions for Oracle Java Certifications
Quality Guaranteed - Pass or Full Refund!
I agree. Here's the link:
subject: JQ+ QUESTION . Pls help!!!!
It's not a secret anymore!