|
Re: Character literals [message #896144 is a reply to message #896065] |
Tue, 17 July 2012 12:04 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
It helps if your example doesn't have typos... I assume you meant to
use '\uXXXX' where XXXX is the hexadecimal character value. You have
only decimal digits and too many of them.
On 17/07/2012 9:06 AM, Jonathan Camilleri wrote:
> Why is the following invalid?
>
>
> package source;
>
> public class CharacterPlay {
>
> public static void main(String[] args) {
> char a = 'a'
>
> char c = 'u\16848'; //invalid character constant
> System.out.println(c);
>
> }
>
> }
>
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\Documents and Settings\Jon>java -version
> java version "1.7.0_04-ea"
> Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b06)
> Java HotSpot(TM) Client VM (build 23.0-b09, mixed mode, sharing)
>
> References
> Banum Unicode Chart at http://www.unicode.org/charts/PDF/U16800.pdf.
> SCJP 1.6 Exam Prep written by K. Bates and Sierra. P.189
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04836 seconds