File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can declear char variable to a ''within the number? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Can declear char variable to a Watch "Can declear char variable to a New topic
Author

Can declear char variable to a ''within the number?

Hades Pan
Ranch Hand

Joined: Nov 25, 2001
Posts: 106
Which of the following are valid declarations?
a) char c= ' \' '
b) char c= "cafe"
c) char c= '\ucafe'
d) char c= '\u01001'
e) char c= '0x001'
Jennifer Warren
Ranch Hand

Joined: Aug 24, 2001
Posts: 53
compile and u'll know.
Jennifer.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4446
    
    5

Hades,
Jennifer is quite right. Please take some time to read Valentin's recently posted suggestions about making good use of this forum.
Thanks,
Junilu


Junilu - [How to Ask Questions] [How to Answer Questions]
Rosie Nelson
Ranch Hand

Joined: Nov 06, 2001
Posts: 31
(a) and (c) represent valid character literals.
(b) "cafe" is obviously a String Literal
(d) and (e) do not conform to the following:-
UnicodeInputCharacter:
UnicodeEscape
RawInputCharacter
UnicodeEscape:
\ UnicodeMarker HexDigit HexDigit HexDigit HexDigit
UnicodeMarker:
u
UnicodeMarker u
RawInputCharacter:
any Unicode character
HexDigit: one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

Have a look at the JLS for more info.
Hades Pan
Ranch Hand

Joined: Nov 25, 2001
Posts: 106
I don't think so it is nonsense on forum
Which the correct way to declear char ???
[This message has been edited by Hades Pan (edited December 01, 2001).]
Hades Pan
Ranch Hand

Joined: Nov 25, 2001
Posts: 106
Thanks for Rosie Nelson so detailed explans for me !
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Originally posted by Hades Pan:
Which the correct way to declear char

JLS 3.10.4 tells you that in details
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100960
HIH

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
 
subject: Can declear char variable to a ''within the number?
 
Similar Threads
Why this output in this I/O program?
assignments and + operator
Dereferenced Error Code
Operators
Beep in Java