Skip to main content
2 of 6
insert duplicate link

Java: How to call super().super() in overriden method (grandparent method)

Possible Duplicate:
Why is super.super.method(); not allowed in Java?

I have 3 classes they inherit from each other as follows:

A ↳ B ↳ C 

Inside each class I have the following method:

protected void foo() { ... } 

Inside class C I want to call foo from class A without calling foo in B:

protected void foo() { // This doesn't work, I get the following compile time error: // Constructor call must be the first statement in a constructor super().super().foo(); } 
Caner
  • 59.7k
  • 37
  • 184
  • 185