How to access a method that it declared as protected?

Answers were Sorted based on User's Feedback



How to access a method that it declared as protected?..

Answer / 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

How to access a method that it declared as protected?..

Answer / ravikiran(aptech mumbai)

a protected method can be accessed with in the same packege
and subclasses outside of the package

Is This Answer Correct ?    2 Yes 1 No

How to access a method that it declared as protected?..

Answer / bulbull

only thru inheritance

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?

0 Answers  


Explain the difference between static and dynamic binding in java?

0 Answers  


What does string mean in java?

0 Answers  


Objects or references which of them gets garbage collected?

0 Answers  


Difference between predicate, supplier and consumer ?

0 Answers  


Is void a return type?

0 Answers  


What are the two main uses of volatile in Java?

0 Answers  


What are access modifiers?

1 Answers   Infosys,


How many characters is 16 bytes?

0 Answers  


What is java used for?

0 Answers  


What do you know about the garbage collector in java?

0 Answers   TCS,


Write a java program to check if a number is prime or not?

0 Answers  


Categories