Why a method cannot be marked both abstract and private? SCJP 5 Study Guide by Kathy and Bates(Page 45) says that its because the child class cannot even see the private abstract method declared in Parent class. But the compiler complains even if i declare a default abstract method in Parent class and dont implement it in the child class defined in another package (i.e. The child class defined in another class knows about the default method declared in another package). Any convincing reason? Or is it just a basic rule in Java?
Originally posted by Moha Shaf: Thanks for your reply. But my question is altogether different. Why is it the compiler allows an abstract method to be default but not private?
An abstract method is like a contract stating "This method will be implemented in an extending class". However, private methods are not visible to an extending class. Private methods are only visible in the class in which they're declared. So a private method can never be declared abstract.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
subject: why private and abstract connot go together?