exceptiondemo5.java

来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 28 行

JAVA
28
字号
/**
*A simple exception handling program using finally
*2004.12.25. xhcprince
*/

public class exceptionDemo5
{
	static String s="2";
	public static void main(String args[])
	{
		try
		{
			int val = 0;
			val = Integer.parseInt(s); //I'm not so clear on it!
			System.out.println("No exception is raised");
		}

		catch(NumberFormatException e)
		{
			System.out.println("Exception is caught");
		}

		finally
		{
			System.out.println("Executing finally block");
		}
	}
}

⌨️ 快捷键说明

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