Originally posted by Gitesh R:
In case of constructors we can access static variables and/or methods though using them only as part of the call to super() or both(). But we cannot access member variables/methods from constructors.
Static members can be accessed from anywhere in the class, be it outside or inside a super/this.
I don't understand your explanation. Can you elaborate more, please?
To me, both statements contradict each other.
I also tried this code sample, where I try to access a static method and a static variable:
It compiles fine and gives the expected output.