The compiler is asking me to make the implemented method (methodB in MainClass) public. But in the original interface (InterfaceA) the scope of methodA is package. Then why do i need to make it public in the implemented class? Thanks and Regards, -skd
Thanks Corey. "How can i have an interface whose methods can be implemented only within the package?" Does the above question make sense because now i understand that everything in an interface is public? Thanks, -skd
Corey McGlone
Ranch Hand
Joined: Dec 20, 2001
Posts: 3271
posted
0
Originally posted by Shravan Durvasula: "How can i have an interface whose methods can be implemented only within the package?"
You can't. All methods defined within an interface are implicitly public. It is a compiler error to override a method with a more restrictive access modifier. If you want that sort of functionality, you'll have to extend a class that has methods assigned the "default" access modifier. Corey