Cyril Sadasivan wrote:
The commented line of code doesn't compile.
I thought it should have because static members can be accessed through objects too.
Any justifications?
I guess it can be argued that if the first is allowed, then the second should be allowed too -- considering other cases where it is similarly allowed.
The answer to this is likely defined somewhere in the JLS, but quite frankly, I was never a fan of using an instance to get to any static component, so never looked it up.... hence, I am leaving it as an exercise to the OP...
Henry