aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confusing question in the Rules roundup game of JavaRanch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Confusing question in the Rules roundup game of JavaRanch" Watch "Confusing question in the Rules roundup game of JavaRanch" New topic
Author

Confusing question in the Rules roundup game of JavaRanch

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I encountered the following question in the Rules Roundup.
(#333)TRUE or FALSE: an overriding method can change
the access modifier from default to protected.
Answer: TRUE
Since the protected modifier is less restrictive than
default, an overriding method is allowed to make that
change.

MY understanding that is when we override methods, we cannot make the overriding method more restricted.
Isn't Protected more restrictive than Default, which i assume is Friendly or Package.
-Hemanth

Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
friendly is more restrictive than protected because it dooes not allow access outside the package. Protedted features are allowed access outside the package provided that the overriding method is in a subclass of the base class..

Hope it helps
Sagar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusing question in the Rules roundup game of JavaRanch