Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
Why is interface default method shadowed by parent private method?

I don't understand why an IllegalAccessError exception is thrown from the example below. The method foo() in Parent cannot be inherited by Child, because it is private. But trying to call the default method foo() leads to the exception.

public class Parent {
    private void foo() {
        System.out.println("Parent-foo");
    }
}

interface Boo {
    default void foo() {
        System.out.println("Boo-foo");
    }
}

class Child extends Parent  implements Boo {
    public static void main(String[] args) {
        new Child().foo();  // runtime IllegalAccessError;
    }
}
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!