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


Please Help Members By Posting Answers For Below Questions

what is the difference between a threads start() and run() methods? : Java thread

528


What is singleton math?

580


What is the difference between error and an exception?

569


how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT

1852


What are the skills required for core java?

543






What are the parts of methodology?

549


What are multiple inheritances?

585


How do you check if two strings are equal in java?

587


Can constructor return value?

512


What variables are stored in stack?

531


Name component subclasses that support painting in java programming?

639


Can a static block throw exception?

660


What is final variable?

497


What is string data?

558


How is a variable stored in memory?

531