总结:运用throw和throws抛出异常,在哪一种情况下该怎么抛出异常。重要
package com.b; //异常中throwe和throws的用法 public class yz { public static void main(String[] args) { System.out.println("新浪微博-----"); try{ System.out.println(1/0); }catch(ArithmeticException e){ System.out.println("除数不为0"); } System.out.println("除数为0后,程序没有终止-----"); } } // 新浪微博----- 除数不为0 除数为0后,程序没有终止-----