first you created an object of class Foo and uing its constructor method you assigned the value as 300. then you created another object calded fooFoo usng the static methdo fooBar. now fooFoo holding the new object which has the x values as 100.
Not sure why are you expecting the output of line 2 to be 100. In java, the parameters are passed by value. Hence anything you do inside the method fooBar has only an impact on the copy of foo passed to it. In "line 2" you are printing the value of original "foo" and not the copy. Hence the output is 300(as it was set for the original).