aspose file tools
The moose likes Ranch Office and the fly likes qs#333 of RRU Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "qs#333 of RRU" Watch "qs#333 of RRU" New topic

qs#333 of RRU

Nalini Mistry
Ranch Hand

Joined: Mar 21, 2000
Posts: 64
the answer says that a default method can be overridden with a protected method coz less restrictive is allowed. From what i have studied, more restrictive is allowed, less restrictive isnt. Please clarify.
paul wheaton

Joined: Dec 14, 1998
Posts: 20791

In this case, the game is correct. Less restrictive is allowed.
Think of polymorphism. If you made it more restrictive, would stuff that is not directly aware of the more restrictive method be allowed to have access? Nope. Therefore, you have a breakdown of polymorphism. If you allow less restriction, polymorphism still works!
One way to be sure -- warm up that compiler and try it out!

permaculture Wood Burning Stoves 2.0 - 4-DVD set
It is sorta covered in the JavaRanch Style Guide.
subject: qs#333 of RRU