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).
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / ravikiran
the access specifies sould not me more restrictive in a
subclass.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sushila
if super class method is public, then override method should
be public.
override method will take same access specifier or expanded one.
the order of access specifier is
private > default > protected > public
Is This Answer Correct ? | 1 Yes | 0 No |
What is I/O Filter?
How infinite loop is declared?
What is comparable and comparator interface? List their differences
is memory to the abstract class allocated ..or objects not instantiated
What is google full form?
What is escape analysis algorithm in JVM and how garbage collection actually worked n how it transfer the objects from one kind of space to other?
What is the difference between error and an exception?
What is the static keyword?
When is the garbage collection used in Java?
Tell us something about an iterator.
What is java util function?
Which is better ascii or unicode?