package cn.itcast_07;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Throw的概述和Throws的区别 {
public static void main(String[] args) {
method();
try {
method2();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void method() {
int a = 10;
int b = 0;
if(b == 0) {
throw new ArithmeticException();
}else {
System.out.println(a/b);
}
}
public static void method2() throws Exception {
int a = 10;
int b = 0;
if(b == 0) {
throw new Exception();
}else {
System.out.println(a/b);
}
}
}