excepdemo3.java

来自「java程序设计语言源代码」· Java 代码 · 共 36 行

JAVA
36
字号
//Example 3 of Chapter 4

import javax.swing.JOptionPane;

public class ExcepDemo3
{
	public static void main(String[] args)
	{
		String string[] = {"Easter Sunday","Thanksgiving","Christmas"};
		String output = "";
		
		int k = 0, m = 0;
		try{
			for(int i=0;i<5;i++)
			{
				k = i + 1;
				output += string[i];
				output += "\n";
				m = i + 1;
			}
		}
		catch(Exception e)
		{
			output += e.toString();
		}
		finally
		{
			output += "\nround " + k + " started";
			output += "\nIt is terminated at round " + m;
		}
		
		JOptionPane.showMessageDialog( null, output );
		System.exit( 0 );
	}
}

⌨️ 快捷键说明

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