InterviewSolution
Saved Bookmarks
| 1. |
Why The Below Code Is Showing Compile Time Error? Interface X { Void Method X(); } Class Y Implements X { Void Methodx() { System.out.println("method X"); } } |
|
Answer» Interface methods MUST be implemented as public. Because, interface methods are public by DEFAULT and you should not REDUCE the VISIBILITY of any methods while overriding. Interface methods must be implemented as public. Because, interface methods are public by default and you should not reduce the visibility of any methods while overriding. |
|