Java Interface Static and Private Method Invocation
Given: Which two method invocations execute? (Choose two.) - 
Community Votes
100% of anonymous learners picked answer AE. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
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.
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.
Community Discussion (3 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option A is correct becausem2 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 becausem4 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()?
Private methods in interfaces have package-private-like scope restricted to the interface itself, so they cannot be called from outside.
Can we call static methods via an instance?
No, static methods must be called using the interface name (e.g., IFace.m3()). Calling them via an instance is a compilation error.