This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by hari harann: char c=9; System.out.println(c);
The above code is compiling fine, but does not produce the output???please explain
Perhaps you meant this:
the primitive literal character is assigned to char variable with single quotes..
Preparing for SCJP 6.0
Joined: Aug 07, 2008
no i did not, its this way only char c=9; without quotes. if this could compile and even run without exceptions, why not it prints the value???
Joined: May 19, 2008
Originally posted by hari harann: no i did not, its this way only char c=9; without quotes. if this could compile and even run without exceptions, why not it prints the value???
If you see the ascii chart(http://www.cppreference.com/ascii.html), then you can see that an integer 9 stands for horizontal tab.. And this is what gets printed on the screen - a horizontal tab.. and you cant see it.. Okay try this:
What do you think this would print??
Try with other ascii values and see what is the output.. [ August 16, 2008: Message edited by: Somnath Paul ]