This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes can we print ascii value of null ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can we print ascii value of null ?" Watch "can we print ascii value of null ?" New topic

can we print ascii value of null ?

vicky ma
Ranch Hand

Joined: May 13, 2009
Posts: 38
can we print ascii value of null ?
if yes , how ?

asper my knowledge its value is 0
pete stein

Joined: Feb 23, 2007
Posts: 1561
Doesn't exist as they are two unrelated concepts.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19557

In C and C++, NULL, 0 and '\0' are all the same. In Java, 0 and '\0' are the same but null is something completely different; it has no ASCII value because ASCII values are only available for chars. null is not a char.

How To Ask Questions How To Answer Questions
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36599
I presume you mean to ask what the "null character" (as it is called in ASCII) looks like when you print it out. It doesn't look like anything. Try this
And you won't see anything.
I agree. Here's the link:
subject: can we print ascii value of null ?
Similar Threads
scjp question required
What happen if we print character '\u0000'
Assigning to char
ASCII Code of Alt + Print Screen
how to print ASCII value of a number ?