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 / 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 |
Post New Answer View All Answers
Can static methods access instance variables in java?
extending thread class or implementing runnable interface. Which is better? : Java thread
What is equlas() and hashcode() contract in java? Where does it used?
Does substring start with 0?
Name few java.lang classes introduced with java 8 ?
Can you make a constructor final in Java?
What classes of exceptions may be thrown by a throw statement?
How to instantiate static nested classes in java?
What is a copy constructor in java?
What is the difference between abstract class and interface1? What is an interface?
Can you inherit a constructor java?
What is fundamental datatype?
What are register variables what are the advantages?
What are the differences between abstract class and interface?
What is a short in java?