While it is possible to access static members of a class through an instance of that class, it is a bad practice to do so.
Always access a static member through the declaring class itself, not an instance of the class.
class SomeClass {
static boolean somethingHappened = false;
public void someMethod() {
// Static value accessed through an object.
this.somethingHappened = true;
}
}
Access the value through the class itself.
public void someMethod() {
SomeClass.somethingHappened = true;
}