Why can nested child classes access private members of their parent class, but grandchildren cannot?

Clever example! But it’s actually a somewhat boring explanation – there’s no visibility problem, you simply have no way of referring to t1 directly from T3 because super.super isn’t allowed. T2 can’t access its own t1 field directly since it’s private (and child classes don’t inherit their parent’s private fields), but super is effectively an … Read more

Instantiating inner class

I think you want to declare the HashPerson class as static. Otherwise it can only be instantiated in the context of the containing class, either in a method of the containing class or using code like this: ContainingClass container = new ContainingClass(); HashPerson william = container.new HashPerson(“willy”); Actually, my rule-of-thumb is to make any nested … Read more

Why inner class can override private final method?

Private methods can not be overridden (private methods are not inherited!) In fact, it makes no difference if you declare a private method final or not. The two methods you have declared, Boom.touchMe and Boom.Inner.touchMe are two completely separate methods which just happen to share the same identifier. The fact that super.touchMe refers to a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)