Tag

JDK source

1 views collected around this technical thread.

Java Captain
Java Captain
Dec 25, 2017 · Fundamentals

Why Printing a null Object in Java Does Not Throw an Exception

This article explores Java's handling of null references when printed or concatenated, showing how PrintStream.print and StringBuilder.append convert null values to the literal string "null" without raising exceptions, and walks through the underlying source code and bytecode.

JDK sourceJavaNull Handling
0 likes · 7 min read
Why Printing a null Object in Java Does Not Throw an Exception