It seems to me that PrintStream.print(Object x)both are PrintStream.println(Object x)identical PrintStream.print(String x)and PrintStream.println(String x).
PrintStream.print(Object x)
PrintStream.println(Object x)
PrintStream.print(String x)
PrintStream.println(String x)
Is there an obvious reason for both? Are they different? API documents readability? Efficiency?
(With autoboxing, I suspect that even printing methods that take primitives as arguments are redundant ... however, these methods precede the autoboxing function to explain.)
They do not do the same:
print(Object x)calls String.valueOf(x)that returns:
print(Object x)
String.valueOf(x)
(obj == null) ? "null" : obj.toString();
So, we have an additional method toString().
toString()
, String.toString() this. API .
String.toString()
this
,
String.valueOf(Object)
PrintStream.print( x)
, null
null
Source: https://habr.com/ru/post/1765048/More articles:Need a reality check. Is my VB6 Blowfish error analysis correct? - debuggingConfiguring an OpenID Provider Using Subdomain Identifiers Using DotNetOpenAuth - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1765045/open-source-how-to-motivate-translators-to-bring-localizations-from-70-to-100-before-release&usg=ALkJrhh28jh-nWlaOsfwdNqVsFqx6RDBPQHow to implement a similar html-page scrubber, for example, to read or install Arc90? - htmlEasy way to export @ 2x images for retina display? - iphonesed extracts several possible (?) values ββfrom a file - shellwill restart apache, clear memcache contents? - apacheWPF loads serialized image - serializationget a list of partitions from an ini file using the shell (sed / awk) - awkhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1765053/how-to-make-sonatypes-nexus-repository-to-work-with-springsources-ebr&usg=ALkJrhhqKsrp0MywP3SXHJNUSYWf_9IOMgAll Articles