public class ThrowDemo {
public static void main(String[] args) {
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// 请解释throw与throws的区别
//throw 在代码块中使用,主要是手动对异常对象抛出
//throws 在方法定义上使用,表示将此方法中可能产生的异常明确告诉给调用处,由调用处进行处理。