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

📄 exceptiondemo2.java

📁 JAVA程序设计课程中各章节的程序实例。
💻 JAVA
字号:
/**Another simple exception example
2004.10.29. xhcprince
*/
class exceptionDemo2
{
	public static void main(String args[])
	{
		try
		{
			String s="hi";
			int a = s.length();
			int b = 42/a;

			System.out.println(a);
			try
			{
				if(a == 1)
				{
					a = a/(a-1);
				}
				if(a == 2)
				{
					int c[] = {1,3};
					c[2] = 55;
				}
			}
			catch(IndexOutOfBoundsException e)
			{
				System.out.println(e);
			}
		}
		catch(ArithmeticException e)
		{
			System.out.println(e);
		}
	}
}

⌨️ 快捷键说明

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