[Java] Generic Method vs Method Overloading | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 8

[Java] Generic Method vs Method Overloading

What's the difference between Generic and Overloading in java ? When should I use Generic and When should I use Overloading ? https://code.sololearn.com/c55P1PJmAnwl/?ref=app

29th Aug 2017, 3:00 PM
Corey
Corey - avatar
1 ответ
+ 8
Generics are used for type safety and to avoid casting, they don't replace overloading which means to define a specific behaviour depending on the arguments. I think this will help you to understand the differences: http://docs.oracle.com/javase/tutorial/extra/generics/intro.html
31st Aug 2017, 8:12 AM
Tashi N
Tashi N - avatar