在java中throw抛出异常的主要步骤

来源:百度知道 编辑:UC知道 时间:2024/06/09 09:16:22

public class test{
static void prt(){
throw Exception();
}
public static void main(String[] args){
try{
prt();
}catch(Exception e){
System.out.println("这就是prt方法抛出的异常");
}
}
}