aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can we print ascii value of null ?" Watch "can we print ascii value of null ?" New topic
Author

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
Bartender

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

Joined: Oct 27, 2005
Posts: 19759
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
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
System.out.println((char)0);
And you won't see anything.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we print ascii value of null ?