0
Overloading & Override in Java
Its seems to be confused for me cuz I couldnât understand anything about it Can someone tell me how can i use it or send to me some links lessons about the topic
6 Answers
+ 5
D_Stark Indeed... đ
It was that combination of "the same signature but different parameters" that immediately jumped out at me when reading your original response.
As such, it wasn't clear if you thought "signature" referred only to the method name and did not apply to the parameter types.
I only posted my explanation to help clarify the subtle distinction. đ€
+ 4
D_Stark Regarding your explanation of method overloading, you wrote:
"Overloading is wen [sic] you have 2 or more methods in the same class with the same signature but diffrent [sic] parameters"
For clarification, "same signature" would imply same parameters. This can exist in the same class or sub classes as well.
That is to say, the method signature includes both the method name and order of parameter types.
Overloading involves different method signatures of the same method names.
Overriding involves the same method signature with different implementations in sub classes.
+ 1
See those website https://www.javatpoint.com/method-overloading-vs-method-overriding-in-java
and
https://www.journaldev.com/32182/overriding-vs-overloading-in-java#:~:text=When%20two%20or%20more%20methods,child%20class%2C%20it's%20called%20Overriding.
For more Simply Google it.
+ 1
David Carroll I did mention diffrent parameters straight after, I was just trying to simplify it.. nevermind I'll delete it, yours seems clear enough to understand.
+ 1
David Carroll no problem đ