Java overloading and overriding
That would be method overloading, as it meets the conditions for method overloading:
- Must have different argument lists
- May have different return types, if argument lists are also different
- May have different access modifiers
- May throw different exceptions
Also overriding can happen only when inheritance is involved. Since both of your methods are in the same class it cannot be overriding.
Overloading means two methods or more with the same name but with different parameters just like your example.While Overriding you implement a method from an interface or abstract class so the method in the super class has an implementation and in the subclass has a different one, Still they have the same method name and parameters.
That's overloading. In brief:
Overriding = replacing
Overloading = give more options
This is overloading. Overriding is used in inheritance when you give different implementation to the same method signature.