Created
November 10, 2014 20:00
-
-
Save flaviocdc/a76a580a59ed67da74c8 to your computer and use it in GitHub Desktop.
Finally Example
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
public class FinallyExample { | |
public static void main(String[] args) { | |
System.out.println(foo("1")); | |
System.out.println(foo("a")); | |
} | |
public static int foo(String numStr) { | |
try { | |
int x = Integer.parseInt(numStr); | |
return x; | |
} catch (Exception e) { | |
return -1; | |
} finally { | |
return Integer.MIN_VALUE; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment