Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Method Overload or Override?

 
Ranch Hand
Posts: 47
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all;)

I encountered an exam Question where it was asked which Methods
could go into a concrete Subclass.

The abstract class was:



and now it was asked which methods could appear in a concrete Subclass of
"Otter."

I created my own Subclass and then inserted the following methods:



What I now wanted to know is:
Is the method


an Override or an Overload?

It is not quite clear to me, though I think
it's an Overload, but I just want to make sure...

Kind regards
Florian
 
Sheriff
Posts: 7647
522
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Florian Jedamzik wrote:It is not quite clear to me, though I think
it's an Overload


  • In order to overload method, the method name needs to be the same, amount of parameters or their types or both should differ. Is this the case?
  • In order to override method, method signature needs to be the same (+ some other rules). What Java method signature consists of?
  •  
    Florian Jedamzik
    Ranch Hand
    Posts: 47
    3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I see;)
    So it's an Overload;)

    Kind regards
    Florian
     
    Willie Smits can speak 40 languages. This tiny ad can speak only one:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic