Overloading vs Overriding
No |
Overloading |
Overriding |
1 |
To increase the readability of the program |
To provide the specific implementation of the method |
2 |
Overloading it performed within class |
Overriding occurs in two classes |
3 |
parameter must be different |
parameter must be same |
4 |
compile time polymorphism |
run time polymorphism |
5 |
Return type can be same or different, but you must have to change the parameter |
Return type must be same or covarient |
'Back-End > Java_1' 카테고리의 다른 글
[Java] Super keyword (0) | 2016.08.25 |
---|---|
[Java] Covariant Return type (0) | 2016.08.24 |
[Java] Method Overriding (0) | 2016.08.24 |
[Java] Aggregation in java (0) | 2016.08.23 |
[Java] Inheritance in Java (0) | 2016.08.23 |