package com.wdxxl.InvocationTargetException;
public class Reflect {
public void runInt(int i) throws ZeroException {
new B().runInt(i);
}
}
class B {
public void runInt(int i) throws ZeroException {
if (i == 0) { throw new OutOfMemoryError("參數(shù)不能=零"); }
if (i == 1) { throw new Error("參數(shù)不能=1"); }
if (i < 0) { throw new ZeroException("參數(shù)不能小于零"); }
System.out.println("參數(shù): " + i);
}
}
class ZeroException extends Exception {
private static final long serialVersionUID = 1L;
private String message;
public ZeroException(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}