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 Restrictions in hibernate?
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.
What is method and methodology?
What is the difference between a Window and a Frame?
What is the effect of keeping a constructor private?
garbate collector(GC)?
why java does not support mulitple inheritance directly?
Can we restart a dead thread in java?
What is meant by method?
What is a stream? what are the different types and classes of Streams?
what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread
What is generics in java interview questions?