| Author |
What happen if we print character '\u0000'
|
Ramakrishna Nalla
Ranch Hand
Joined: Apr 21, 2005
Posts: 61
|
|
Program outputs nothing... What is defalut value of char datatype..what happens if we print that char.. Waiting for your comments... Cheers... [ July 10, 2005: Message edited by: Barry Gaunt ]
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
See this ASCII table... http://www.lookuptables.com/
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Ramakrishna Nalla
Ranch Hand
Joined: Apr 21, 2005
Posts: 61
|
|
I know ascii value of 0 is NULL...Please clearly explain me why... java unable to execute statements after this statement char c=0; System.out.println(c);//default value:'\u0000' System.out.println("This will not print"); Thanks
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
It depends upon your output device. For me it prints:
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Originally posted by Ramakrishna Nalla: ... java unable to execute statements after this statement...
I tested your code with Java 5.0 in the Windows XP Command Prompt, and also in Mac 10.4.1 Terminal. In both cases, I get the same result as Barry posted above. The "null" char prints nothing, but does not cause any problems. What environment are you running this in? Are you getting an error message?
|
 |
Ramakrishna Nalla
Ranch Hand
Joined: Apr 21, 2005
Posts: 61
|
|
Thank U Very Much marc, editplus 2.12 is driven me in to mistake...by your suggestion i tested program in XP command it worked normally...By this experiance i known only command prompt is best for testing java programs...especially for SCJP... Thanks
|
 |
 |
|
|
subject: What happen if we print character '\u0000'
|
|
|