Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we print ascii value of null ?

 
vicky ma
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we print ascii value of null ?
if yes , how ?

asper my knowledge its value is 0
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't exist as they are two unrelated concepts.
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49751
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic