How to access a method that it declared as protected?
Answers were Sorted based on User's Feedback
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 |
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 |
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?
Explain the difference between static and dynamic binding in java?
What does string mean in java?
Objects or references which of them gets garbage collected?
Difference between predicate, supplier and consumer ?
Is void a return type?
What are the two main uses of volatile in Java?
What are access modifiers?
How many characters is 16 bytes?
What is java used for?
What do you know about the garbage collector in java?
Write a java program to check if a number is prime or not?