Posts

Showing posts with the label overloading

Java Method Overloading

Image
 Method Overloading   A  Method is something that groups a coding set and keeps it. Let's create 2 Methods now. ( same class ).     ( But  it is not allowed to create more than one method with the same name in the same class ) Even though we are not allowed to create more than one method with the same name in the same class, we create it anyway. Creating multiple methods with the same name in the same class ( changing the parameters  signature ) is called  Method Overloading . We can do method overriding by changing the parameters inside the methods. Example 1 👇 Since we have been given an integer argument of 5 , it will be called at the ( 1)   Example 2 👇 Since we have not put an integer argument here, it will be called at (2) Example 3 👇 If you put an integer argument, it will be called at   (1). If you put two integer arguments, it will be called at   (2). If we change the parameters, we can grab them separately when calling . Example 4 👇