I have defined an object and declared a static variable i. In the get() method, when I try to print the instance and class variable, both print the
The field i is declared as static. You can access static fields either with the YourClass.StaticField or instance.StaticField. So both of
this.i
test.i
are referring to the same value in the context of an instance method of your test class.
It's considered bad practice to access a static field with this.i or instance.i.