I use windows 10,jdk1.8.
I use this code to test my program:
public class Unbelievable { public void test() { int a = 5; while ((a -= 2) > 0){ //nothing to do } System.out.println("result= " + a); } public static void main(String[] args) { Unbelievable un = new Unbelievable(); for (int i = 0; i < 2000_0; i++) { un.test(); } } }
When I run the code.The output likes this:
result= -1 result= -1 result= -1 result= -1 …… result= / result= / result= / result= / result= / result= / result= / result= / result= /
There are 12821 result= -1
and 7179 result= /
,I don't understand why the result is like this.I think all the result shoule be result= -1
.
没有评论:
发表评论