我在Eclipse中輸入了簡單的算術程序。在Eclipse中運行程序時,每次運行時,輸出都會以奇怪的順序顯示。有時候最後的打印語句最先出現的異常(這是正確的方式)。有時它會以混亂的順序反過來。爲什麼會發生&如何糾正它?每次執行時是否有任何設置使其以正確的方式打印。下面的屏幕截圖顯示了它的顯示方式。請幫我解決這個問題。Eclipse中的控制檯打印訂單
正確順序:
順序不正確,當我們跑幾次後
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);
}
}
附註,不涉及答案:如果你想添加形式'[描述](鏈接)''的鏈接,那麼不要忘記協議如'http:/ /'在鏈接。或者更好的是使用'Ctrl + L'選項。這會將'http://'部分添加到您的鏈接中,並使您的答案稍後更易於編輯。 – Pshemo