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("参数不能=零"); }
if (i == 1) { throw new Error("参数不能=1"); }
if (i < 0) { throw new ZeroException("参数不能小于零"); }
System.out.println("参数: " + 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;
}
}