testchapter6.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 27 行

JAVA
27
字号
public class TestChapter6
{
	static public void main(String[ ] args) throws Exception
	{
		Account a = new Account("Jeremy", 100.00f, 1000.00f);
		a.deposit(500.00f);
		a.withdraw(200.00f);
		a.changeLOC(1500.00f);
				
		int size = -10;
		ArrayedStack s;
		try
		{
			s = new ArrayedStack(size);
		} catch (NegativeStackSizeException e)
		{
			System.out.println("Caught the NegativeStackSizeException exception");
			System.out.println("The class of the exception is " + e.getClass());
			System.out.println("The message with the exception is: " + e.getMessage());
			System.out.println("So far the stack trace is: ");
			e.printStackTrace();
			System.out.println("Attempt to carry on with the default size of 10.");
			s = new ArrayedStack(10);
		}
	}
}

⌨️ 快捷键说明

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