This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
character literals ..do i need to mug up these .. what is \u followed by no?i saw soo many questions having \u followed by nos.
please suggest any article which will help me to understand this thing .
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
posted
0
A character literal consists of single-quotes which enclose a single Unicode character or a so-called escape sequence.
For example 'A' is a character literal which represents the uppercase letter A; and '\u0041' is an alternative representation A for as all sequences of a backslash, followed by an ``u'', and four hex digits (giving 16 bits) are replaced by the corresponding Unicode character. Note that the \u-notation is permitted everywhere in a Java program, not just within character literals. This allows all Unicode characters to be specified within a Java program even if the full Unicode character set is not supported by the current environment.
However, not all Unicode characters can be directly given within a character literal. ''' or '\' are not permitted and likewise neither CR (carriage return) nor LF (line feed) which may be used for line terminators.
Firas Zuriekat
Ranch Hand
Joined: May 09, 2006
Posts: 143
posted
0
There is no compliler errors and the output is: abcd'A'A?
I don't think it's on the exam because none of SCJP5 objective mention unicode chars.