Post increment operator not incrementing in for loop

前端 未结 5 1696
我在风中等你
我在风中等你 2020-11-28 13:04

I\'m doing some research about Java and find this very confusing:

for (int i = 0; i < 10; i = i++) {
  System.err.print(\"hoo... \");
}

5条回答
  •  独厮守ぢ
    2020-11-28 13:08

    because of i=i++

    for (int i = 0; i < 10;  i++) {
      System.err.print("hoo... ");
    }
    

提交回复
热议问题