when asub class inherits a super class and overrides a
public method of super class in sub class(public method in
super class).
why these methods needs to be public in sub class.
(otherwise compile time error).
Answer Posted / imtiyaz
The access specifier for the overriding method can allow
more but not less access than the overridden method.
For example, a protected method in the superclass can be
made public but not private
private, protected and public is Ascending order of access
modifiers depending upon the strength
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is a file pointer?
Why string is a class?
What are the differences between getting and load method?
What are reference variables in java?
Do I need java on my computer?
What is logical variable?
Is string is a keyword in java?
Is math class static in java?
Explain about instanceof operator in java?
What is widening and narrowing in java? Discuss with an example.
What do you mean by local variable and instance variable?
Does java allow overriding static methods ?
What is the size of integer?
What are the pillars of java?
If you do not want your class to be inherited by any other class. What would you do?