@@ -21,24 +21,24 @@ For example `add(int a, int b)` or `add(int a, int b, int c)` or `add(double a,
21
21
22
22
> ** What Is Method Signature In Java?**
23
23
>
24
- > In Java, method signature contains method name and type of arguments.
24
+ > In Java, the method signature contains the method name and type of arguments.
25
25
>
26
26
> method-name(argument-type-1, argument-type-2...)
27
27
>
28
28
> Ex. ` getData(int, String) `
29
29
>
30
- > ** Note:** In java , the method signature does not include the name of parameter, it only includes it's datatype.
30
+ > ** Note:** In Java , the method signature does not include the name of the parameter, it only includes its datatype.
31
31
32
32
---
33
33
34
34
Compile-time polymorphism can be achieved by Method overloading.
35
35
36
36
In Java, there are two ways to overload the method.
37
37
38
- 1 . By changing number of arguments
38
+ 1 . By changing the number of arguments
39
39
2 . By changing the data type of arguments
40
40
41
- ## 1. By changing number of arguments
41
+ ## 1. By changing the number of arguments
42
42
43
43
We can overload a method ** by changing the number of arguments i.e parameters it receives** .
44
44
@@ -47,13 +47,13 @@ As shown in the example from the introduction, we can overload the method `add(i
47
47
``` java
48
48
public class Operation {
49
49
50
- public static int add (int a , int b ){
51
- return a+ b;
52
- }
53
-
54
- public static int add (int a , int b , int c ){
55
- return a+ b+ c;
56
- }
50
+ public static int add (int a , int b ){
51
+ return a+ b;
52
+ }
53
+
54
+ public static int add (int a , int b , int c ){
55
+ return a+ b+ c;
56
+ }
57
57
58
58
}
59
59
```
@@ -67,13 +67,13 @@ As shown in the example from the introduction, we can overload the method `add(i
67
67
``` java
68
68
public class Operation {
69
69
70
- public static int add (int a , int b ){
71
- return a+ b;
72
- }
73
-
74
- public static double add (double a , double b ){
75
- return a+ b;
76
- }
70
+ public static int add (int a , int b ){
71
+ return a+ b;
72
+ }
73
+
74
+ public static double add (double a , double b ){
75
+ return a+ b;
76
+ }
77
77
78
78
}
79
79
```
0 commit comments