Question: What will be the output of the following code snippet? try { String name = null; System.out.printf(The length of the string is - %d, name.length());
What will be the output of the following code snippet?
try {
String name = null;
System.out.printf("The length of the string is - %d", name.length());
}
catch (RuntimeException e)
{
System.out.printf("Runtime Exception");
}
catch (NullPointerException e)
{
System.out.println("Null Pointer Exception");
}
Step by Step Solution
3.34 Rating (157 Votes )
There are 3 Steps involved in it
The output of this code snippet will be Null Pointer Exception Heres why The ... View full answer
Get step-by-step solutions from verified subject matter experts
