• Post Reply Bookmark Topic Watch Topic
  • New Topic

code print null  RSS feed

 
Jaikant Singh
Greenhorn
Posts: 16
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


why this code print null?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikant Singh wrote:

why this code print null?



Take a look at the JavaDoc for the java.io.PrintStream class.

Henry
 
Jaikant Singh
Greenhorn
Posts: 16
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
print

public void print(String s)

Prints a string. If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.

Parameters:
s - The String to be printed

print

public void print(Object obj)

Prints an object. The string produced by the String.valueOf(Object) method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.

Parameters:
obj - The Object to be printed
See Also:
Object.toString()



I got the answer.
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!