下载后可任意编辑实验 7 异常处理与异常类一
实验目的及实验环境 1 理解 Java 异常的基本概念和处理机制
2 掌握 Java 异常处理的方法( 抛出和捕获异常; try、 throw、 throws、 catch 语句和 finally 的用法) 3 理解异常类的作用, 掌握创立异常类的方法
实验内容 1 基本内容( 实验前请及时熟悉如下相关内容) 1) Java 的异常处理机制2) 异常类的应用3) 常见的异常(除数为零等)4) 多异常处理5) 由方法抛出异常6) 必须要捕获的异常 2 综合实验: 2
Daniel Liang英文版第10版P488: 12
2* (InputMismatchException)) (Y
Daniel Liang英文版八版P456: 13
2*) (NumberFormatException) Write a program that prompts the user to read two integers and displays their sum
Your program should prompt the user to read the number again if the input is incorrect
Daniel Liang英文版第10版P488: 12
3* ) (Y
Daniel Liang英文版八版P456: 13
3*) (ArrayIndexOutBoundsException) Write a program that meets 下载后可任意编辑the following requirements:■ Create an array with 100 randomly chosen integers
■ Prompt the user to enter