-
-
Save ozkansari/4536819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* What is printed to standard output ? | |
* | |
* a) "NullPointerException thrown" | |
* b) "Exception thrown" | |
* c) "Done with exceptions" | |
* d) "checkResult is done" | |
* e) None of the above | |
* | |
*/ | |
void checkResult(String result) { | |
try { | |
String expected = null; | |
if(expected.equals(result)){ | |
System.out.println( "Success" ); | |
} | |
} catch( NullPointerException npex ) { | |
System.out.println( "NullPointerException thrown " ); | |
} catch( Exception ex ) { | |
System.out.println( "Exception thrown " ); | |
} finally { | |
System.out.println( "Done with exceptions " ); | |
return; | |
} | |
System.out.println( "checkResult is done" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment