<分区>
我在 Eclipse 中输入了一个简单的算术程序。在 Eclipse 中运行程序时,每次运行时输出都会以奇怪的顺序出现。有时异常最后出现 print 语句最先出现(这是正确的方式)。有时它以困惑的顺序出现,反之亦然。为什么会发生以及如何纠正?每次执行时是否有任何设置使其以正确的方式打印。下面的屏幕截图显示了它的显示方式。请帮我解决这个问题。
正确顺序:
我们运行几次后顺序不正确
package com;
public class Abc {
/**
* @param args
*/
public static void main(String[] args) {
System.out.println("begin main");
// TODO Auto-generated method stub
int a = 10;
int b = 0;
int c = 0;
System.out.println("value of a BD is " + a);
System.out.println("value of b BD is " + b);
System.out.println("value of c BD is " + c);
c = a/b; //Arthmetic Exception
System.out.println("value of a AD is " + a);
System.out.println("value of b AD is " + b);
System.out.println("value of c AD is " + c);
}
}