Advertisement
apl-mhd

Thread ErrorFix Spring2017b

Jan 10th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. package one172;
  2.  
  3.  
  4. import java.io.IOException;
  5.  
  6. public class TestExceptionError {
  7.         public static void main(String[] args) {
  8.             try {
  9.                 whoIs("IOException");
  10.             }
  11.  
  12.  
  13.             catch (IOException e) {
  14.                 e.printStackTrace();
  15.             }
  16.             catch (Exception e) {
  17.                 e.printStackTrace();
  18.             }
  19.  
  20.             finally{
  21.                 System.out.println("Always executes.");
  22.             }
  23.             System.out.println("Which exception should be handled?");
  24.         }
  25.         public static void whoIs(String n) throws IOException {
  26.             System.out.println("Who is "+n+"?");
  27.         }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement