permaculture playing cards*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "qs#333 of RRU" Watch "qs#333 of RRU" New topic
Author

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
Trailboss

Joined: Dec 14, 1998
Posts: 20488
    ∞

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: qs#333 of RRU
 
Similar Threads
Access modifier level hierarchy in overriding
Confusing question in the Rules roundup game of JavaRanch
Overriding
If i want to report a bug
protected vs public void doGet