$CATEGORY: $course$/test 4 ::Exception handling::
Given the following piece of code, what is the expected output?
public static void main(String args[]){ =There is a NullPointerException. Main continued. ~There is a NullPointerException. ~There is a NullPointerException. There is an Exception. ~The code will not compile, because there are no pointers in Java. ~The code will not compile because NullPointerException is not a checked exception. }
\{
try
\{
String s \= null;
System.out.println("s first char is " + s.charAt(0));
\}
catch(NullPointerException n)
\{
System.out.print("There is a NullPointerException. ");
\}
catch(Exception e)
\{
System.out.print("There is an Exception. ");
\}
System.out.println("Main continued. ");
\}