chuxueaihaozhe
发贴: 26
积分: 0
|
于 2005-07-15 21:53
public class MultiCatch { public static void main(String[] args) throws ArithmaticException,ArrException { try { int a = args.length; int b = 42/a; int [c] = {1}; c[44] = 99; ArithmaticException e = new ArithmaticException(); throw e; ArrException x = new ArrException(); throw x; } catch(ArithmaticException e) { System.out.println("div by 0:" + e); e.getMessage(); } catch(ArrException x) { System.out.println("arry index oob:" + x); } } } class ArithmaticException extends Exception{} class ArrException extends Exception{} =================================== c:\myclass>javac MultiCatch.java MultiCatch.java:13:unreachable statement ArrException x = new ArrException(); ^ 1 error
|