Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Sum
- {
- //private static int x;
- public static int sum(int a, int b)
- {
- x = a + b;
- return x;
- }
- //private static int y;
- public static int sum(int a , int b, int c)
- {
- y = x + c;
- return y;
- }
- //private static int z;
- public static int sum(int a, int b, int c, int d)
- {
- z = y + d;
- return z;
- }
- }
- class MainSum
- {
- public static void main(String[] args)
- {
- //Sum S = new Sum();
- System.out.println(S.sum(1,2));
- System.out.println(S.sum(0,2,2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement