Method overload is polymorphism?

I am having difficulty understanding the concept of polymorphism in Java, I read two articles from the same portal now and got confused more, because for my interpretation they contradict each other:

Stretch 1:

" method overload is a concept of polymorphism that basically consists of creating variations of the same method, that is, the creation of two or more methods with totally equal names in a class. Overload allows us to use the same name in more than one method as long as their argument lists are different so that they are separated."

Https://www.devmedia.com.br/sobrecarga-e-sobreposicao-de-metodos-em-orientacao-a-objetos/33066

Stretch 2:

" polymorphism is the principle by which two or more classes derived from the same superclass can invoke methods that have the same identification, signature, but distinct behaviors, specialized for each derived class, using for both a reference to an object of the type of the superclass. Overload is not a type of polymorphism, because with overload the signature of the method must have different arguments, a requirement that hurts the concept of polymorphism cited above " https://www.devmedia.com.br/encapsulamento-polimorfismo-heranca-em-java/12991

So method overload is polymorphism too?

Author: Maniero, 2018-06-27

1 answers

In general, publications, some even well-known, can be wrong. Actually everyone can. There's a lot of wrong stuff out there, often just for some oversight.

Note that in this case they are different articles from different authors, so it is normal for each one to have a view, here you will see another (s). Not always one is wrong just because it is different from another. Not in this case, but it's also good to always look at the date of publication. And the author's credentials, because paper and HTML accept everything.

Method overload is a concept of polymorphism that basically consists of creating variations of the same method, that is, the creation of two or more methods with totally equal names in a class. Overloading allows us to use the same name in more than one method as long as its argument lists are different so that the same

May be a polymorphism ad-hoc , but people don't usually use this term in everyday life.

The text is confusing and incomplete, but it is technically correct. The article as a whole is full of strange and even clearly incorrect things in the details.

Polymorphism is the principle by which two or more classes derived from the same superclass can invoke methods that have the same identification, signature, but distinct behaviors, specialized for each derived class, using for both a reference to an object of the superclass type. Overload is not a type of polymorphism, because with overload the signature of the method must have different arguments, a requirement that hurts the concept of polymorphism cited above

Why do you need two classes at least? Isn't one enough? It started badly. usando para tanto uma referência a um objeto do tipo da superclasse seems confusing or just incorrect even. I like this school more to consider overload as something different, although theoretically even it is, in practice we do not use this term.

It should quote where there is the requirement that the signature must be equal to be polymorphism. I have the impression that he can not, that is unfounded. I say that because he is substantiating. If it were just to quote, ok, if it's just to use different terms for each mechanism, that's good to get easier to communicate intent.

The article has other things kind of "loose".

To be polymorphism there has to be method overload, pus as wrong, so I got it right?

There are controversies. The classic overhead is horizontal, it is to have methods with the same name, but with different signatures . There are those who call vertical overload polymorphism where an identical method in the signature has different behavior depending on the level of inheritance it is. But I prefer to call it just polymorphism to avoid confusion. And it can occur dynamically, the most common, or static in general with templates or generics * .

I would not trust the articles.

 6
Author: Maniero, 2020-07-23 14:39:49