// count=count++;
// step 1: JVM copy count value to temp
// step 2: count incremented by 1
// step 3: assign temp to count, count reset to 0
public class SelfIncrementTest {
public static void main(String[] args){
int count = 0;
for (int i=0;i<10;i++){
count = count++;
}
System.out.println(count);
}
}
OUTPUT
0
No comments:
Post a Comment