How to access a method that it declared as protected?

Answer Posted / ranganathkini

If a method is marked protected, only the subclass of that
class can access it. To make it accessible to other classes,
the subclass of that class can override the protected method
and the override can be marked as public making it
accessible to other classes.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a method in programming?

884


What kind of variables a class can consist of?

860


Differentiate between postfix and prefix operators in java.

883


What are unchecked exceptions in java?

835


Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.

1765


What is default exception handling in java?

775


What is the byte range?

804


What is the main purpose of java?

763


Can you write a java class that could be used both as an applet as well as an application?

721


What are features of java?

784


What is the core java?

733


What is Session reduplication and how its done?

1783


What is struts in java?

819


Can a method be static?

741


What is parseint?

734