Java Interface Static and Private Method Invocation
Short answer
AE New MyC().m2() invokes the default method, and IFace.m3() invokes the static method.
Question

Key Takeaways
The question tests knowledge of access rules for private and static interface members, with the common trap being confusion between static/non-static and public/private accessibility.
This Java SE 8+ question tests the ability to invoke static and private methods defined within an interface. The correct answer identifies the valid syntax for calling these specific method types directly on the interface or via instance creation.
Common mistake: Learners often select options involving instance variable assignment (C/D) without realizing they fail due to non-static/static mismatches or private access violations when attempting to call methods.
Expert Analysis
Why the Answer Is Correct
Option A is correct because m2 is a default method in the interface, which can be invoked on an instance of the implementing class MyC. Option E is correct because m3 is a static method in the interface, which must be invoked using the interface name IFace.m3.
Why the Other Options Are Wrong
Option B fails because m4 is a private method, making it inaccessible from outside the interface. Options C and D are syntactically valid assignments but do not constitute 'method invocations' as requested; furthermore, subsequent calls implied by these contexts would fail: myClassObj.m3 (calling static via instance) and myClassObj.m4 (accessing private).
Community Comment Notes
Community consensus strongly supports AE. As SrinivasJasti noted, "private method not accesible" explains why B is wrong, and "non static access of static method not possible" clarifies why calling static methods via instances is invalid.
Exam Strategy
For interface questions, immediately check if the method is static or default. Static methods require the interface name; default methods require an instance. Private methods are never accessible externally.
Frequently Asked Questions
Why can't we call IFace.m4()?
Can we call static methods via an instance?
Community Votes
100% of anonymous learners picked answer AE. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 3 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 3
-
SrinivasJasti 👍 1B. IFace.m4(); // private method not accesible C. IFace myClassObj = new MyC(); myClassObj.m3(); //non static access of static method not possible D. IFace myClassObj = new MyC(); myClassObj.m4(); // private access not possible IFace.m2(); // static access non static method not possible
-
supersquax 👍 5A and E correct!:)
-
xplorerpj 👍 2A&E are correct
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.