Monday, April 30, 2007

If the method to be overridden has access type 'protected', can subclass have the access type as 'private'?

No, it must have access type as protected or public, since an overriding method must restrict access of the method it overrides.

2 comments :

Kavita on May 19, 2011 at 10:14 AM said...

So here you mean we cannot reduce the visibility of inherited method.

Anonymous said...

i didnt understand the logic here..can u please xplain in detail

 

Disclaimer
Interview Questions On Java,Java EE Copyright © 2017. Reads: best tracker