总结:运用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后,程序没有终止-----

  

相关文章:

  • 2021-11-08
  • 2022-02-22
  • 2021-11-22
  • 2021-06-15
  • 2021-07-08
  • 2021-09-29
  • 2021-09-29
猜你喜欢
  • 2022-12-23
  • 2021-06-20
  • 2021-05-31
  • 2021-07-04
  • 2022-12-23
  • 2021-11-06
  • 2021-11-24
相关资源
相似解决方案