throws  使用在函数上, 后面跟的是异常类.可以跟多个,用逗号隔开

throw使用在函数内, 后跟的是异常对象

 

class Demo {

         public int div(int a, int b) throws NegativeException {
                if (b < 0) {
                   throw new NegativeException("除数是负数了");
            }
                return a / b;
       }
}