Consider the following example:
class Quirky { public static void main(String[] args) { int x = 1; int y = 3; System.out.println(x =
Basically the first statement x had it's value 1 So Java compares 1 == to new x variable which won't be the same
In the second one you said x=y which means the value of x changed and so when you call it again it'll be the same value hence why it's true and x ==x