import java.util.*; public class ExceptionTest { public static void main(String[] args){ int a,b,c; Scanner re=new Scanner(System.in); System.out.println("请输入除数"); a=re.nextInt(); System.out.println("请输入被除数"); b=re.nextInt(); try{ c=a/b; System.out.println(c); } catch(Exception t){ t.printStackTrace(); System.out.println("被除数为零"); } finally{ System.out.print("程序继续"); } } }
第6次实训作业异常处理
猜你喜欢
转载自www.cnblogs.com/lijiawei123/p/10985971.html
今日推荐
周排行