StringBuffer sb=null; // Some more logic that conditionally assigns value to the StringBuffer // Prints Value=null System.out.println(\"Value=\"+sb); // Throws Nu
The ternary operation bypasses the toString method on the null object, which is what is causing the NullPointerException.