⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exceptiondemo.java

📁 JAVA编程思想源代码 值得一下 很难找的
💻 JAVA
字号:
package chapter14;

public class ExceptionDemo {

	public static void main(String[] args) {

		boolean flag = true;
		try {
			int chu = Integer.parseInt(args[0]);
			int num = 50;
			System.out.println(num + "/" + chu + " is :" + num / chu);
		} catch (ArithmeticException e) {
			flag = false;
			System.out.println("代码中出现 除以0 的错误");
		} catch (ArrayIndexOutOfBoundsException e2) {
			flag = false;
			System.out.println("用户没有输入参数");
		} finally {
			if (flag == true)
				System.out.println("程序正常结束");
			else if (flag == false)
				System.out.println("程序发生异常");
		}

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -