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 |
Write a program to find the greatest of three numbers in java?
What is 'finally' method in Exceptions?
What is natural ordering in java?
What is fail fast in java?
What is the exact difference in between Unicast and Multicast object ?
What are the special characters?
Differentiate between the constructors and methods in java?
What is a memory leak in java?
What does escaping a character mean?
What is the difference between && and & in java?
What are instance variables?
When should we create our own custom exception classes?