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 the purpose of the main method?

781


How do you check if a string contains only numeric digits?

908


Differentiate between the constructors and methods in java?

760


What is the formula to calculate percentage?

793


What's the purpose of using break in each case of switch statement?

793


How do you remove duplicates from an array in java?

758


Which list does not allow duplicates in java?

738


Explain the polymorphism principle?

813


What one should take care of, while serializing the object?

700


Can a boolean be null java?

779


What does replaceall do in java?

730


Tell me about your ability to work under pressure

1993


What is port number in java?

842


What is the difference between @before and @beforeclass annotation?

767


Can an arraylist be empty?

830