Warum geht das in eine Endlosschleife?

Ich habe den folgenden Code:

public class Tests {
    public static void main(String[] args) throws Exception {
        int x = 0;
        while(x<3) {
            x = x++;
            System.out.println(x);
        }
    }
}

Wir wissen, dass er nur @ hätte schreiben sollx++ oderx=x+1, aber amx = x++ sollte es zuerst Attributx auf sich selbst und erhöhen Sie es später. Warum tutx weitermachen mit0 als Wert?

--aktualisiere

Hier ist der Bytecode:

public class Tests extends java.lang.Object{
public Tests();
  Code:
   0:   aload_0
   1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
   4:   return

public static void main(java.lang.String[])   throws java.lang.Exception;
  Code:
   0:   iconst_0
   1:   istore_1
   2:   iload_1
   3:   iconst_3
   4:   if_icmpge   22
   7:   iload_1
   8:   iinc    1, 1
   11:  istore_1
   12:  getstatic   #2; //Field java/lang/System.out:Ljava/io/PrintStream;
   15:  iload_1
   16:  invokevirtual   #3; //Method java/io/PrintStream.println:(I)V
   19:  goto    2
   22:  return

}

Ich werde über das @ lesAnleitun versuchen zu verstehen ...

Antworten auf die Frage(52)

Ihre Antwort auf die Frage