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
1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?
What is early binding and late binding in java?
What is the equal sign?
What is reverse function?
Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.
Where is the singleton class used?
Which one of the following suits the description of a string better: derived or primitive?
What is the static method?
Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?
What is run time allocation?
does java support pointers?
Difference between string, stringbuffer and stringbuilder?
Explain the difference between the public, private, final, protected, and default modifiers?
Why for each loop is used?
What is the advantage of preparedstatement over statement?