Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Carolina Lopez   on Feb 16 In Java Category.

  
Question Answered By: Willie Gomez   on Feb 16

This code  will compile fine with no error.

However what you have written is not method  overriding



To override method you must declare them with same signature

I.e.

1) The return type, method name, and number and type of the parameters for
the overriding  method must match those in the overridden method.

2) The overriding method can have a different throws clause as long as it
doesn't declare any types not declared by the throws clause in the
overridden method.

3) Access specifier for the overriding method can allow more access than the
overridden method, but not less. For example, a protected method in the
superclass can be made public but not private.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Static method overriding Or get search suggestion and latest updates.


Tagged: