forked from sPredictorX1708/Ultimate-Java-Resources
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaMethods.java
More file actions
34 lines (27 loc) · 603 Bytes
/
JavaMethods.java
File metadata and controls
34 lines (27 loc) · 603 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.io.*;
class Addition
{
// adding two integer value.
public int add(int a, int b)
{
int sum = a+b;
return sum;
}
}
class GFG
{
private static int addTwo(int a,int b){
int sum = a+b;
return sum;
}
public static void main (String[] args)
{
Addition ob = new Addition();
int sum1 = ob.add(1,2);
System.out.println("sum of the two integer value :" + sum1);
int sum2 = ob.add(1,2);
System.out.println("sum of the three integer value :" + sum2);
int sum3 = addTwo(1,2);
System.out.println(sum3);
}
}