我注意到一旦抛出错误,Netbeans 就会弄乱整个输出。它使输出看起来像这样难以理解的混乱:
Pushing elements onto doubleStack
1.1 2.2 3.3 4.4 5.5 6.6
Exceptions.FullStackException: Stack is full, cannot push 6.6
Popping elements from doubleStack
5.5 4.4 3.3 2.2 1.1
at domein.Stack.push(Stack.java:37)
Pushing elements onto integerStack
at StackApplicatie2.testPush(StackApplicatie2.java:40)
1 2 3 4 5 6 7 8 9 10 11
at StackApplicatie2.testStacks(StackApplicatie2.java:24)
Popping elements from integerStack
at StackApplicatie2.main(StackApplicatie2.java:75)
<etc. …>
而不是人们所期望的:
Pushing elements onto doubleStack
1.1 2.2 3.3 4.4 5.5 6.6
Exceptions.FullStackException: Stack is full, cannot push 6.6
at domein.Stack.push(Stack.java:37)
at StackApplicatie2.testPush(StackApplicatie2.java:40)
at StackApplicatie2.testStacks(StackApplicatie2.java:24)
at StackApplicatie2.main(StackApplicatie2.java:75)
Popping elements from doubleStack
5.5 4.4 3.3 2.2 1.1
Pushing elements onto integerStack
1 2 3 4 5 6 7 8 9 10 11
Popping elements from integerStack
<etc. …>
我只是想知道:Netbeans 8.1 给出如此奇怪的输出是否正常?