📄 stackcompositiontest.java
字号:
// StackCompositionTest.java
// Class StackCompositionTest
public class StackCompositionTest {
public static void main( String args[] )
{
StackComposition objStack = new StackComposition();
// Create objects to store in the stack
Boolean b = Boolean.TRUE;
Character c = new Character( '$' );
Integer i = new Integer( 34567 );
String s = "hello";
// Use the push method
objStack.push( b );
objStack.print();
objStack.push( c );
objStack.print();
objStack.push( i );
objStack.print();
objStack.push( s );
objStack.print();
// Use the pop method
Object removedObj = null;
try {
while ( true ) {
removedObj = objStack.pop();
System.out.println( removedObj.toString() + " popped" );
objStack.print();
}
}
catch ( EmptyListException e ) {
System.err.println( "\n" + e.toString() );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -