need to know basic

8 views
Skip to first unread message

shweta sharma

unread,
Apr 2, 2012, 4:26:38 AM4/2/12
to bo...@googlegroups.com
Hi ,

:-( i am sorry to post a small basic Q. I have forgotten Java basics while working over long period on different web technologies.
here is the Q

        char ch=296;
        System.out.println("ch"+ch + "int "+(int)ch);

i m not getting for what ever value > 255 ch prints  program prints ? only ....

if ch=3780 then too ch prints ? and  (int )ch prints 3780 ...

in my understanding it should have  printed character  corresponding to 3780%256 .

does anybody has idea  why ? 

thanks
shweta 

singh.janmejay

unread,
Apr 5, 2012, 11:34:10 AM4/5/12
to bo...@googlegroups.com

Java uses wide characters (2 words). You probably are using sequences that do not map to printable characters in your locale, or you are using a fontset that doesn't have glyph for that character.

--
You received this message because you are subscribed to the Google Groups "Bangalore Open Java Users Group- BOJUG" group.
To post to this group, send email to bo...@googlegroups.com.
To unsubscribe from this group, send email to bojug+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bojug?hl=en.

singh.janmejay

unread,
Apr 5, 2012, 12:43:07 PM4/5/12
to bo...@googlegroups.com

PS: Sorry, I meant 2 bytes where I said 2 words.

shweta sharma

unread,
Apr 6, 2012, 6:54:45 PM4/6/12
to bo...@googlegroups.com
Thanks janmeyjay.

i got ur point.

thanks
shweta
Reply all
Reply to author
Forward
0 new messages