Advertisement
alexarcan

lab2.7

Oct 3rd, 2014
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class Sum
  2. {
  3. //private static int x;
  4.  
  5. public static int sum(int a, int b)
  6. {
  7. x = a + b;
  8. return x;
  9. }
  10.  
  11. //private static int y;
  12.  
  13. public static int sum(int a , int b, int c)
  14. {
  15. y = x + c;
  16. return y;
  17. }
  18.  
  19. //private static int z;
  20.  
  21. public static int sum(int a, int b, int c, int d)
  22. {
  23. z = y + d;
  24. return z;
  25. }
  26. }
  27.  
  28. class MainSum
  29. {
  30. public static void main(String[] args)
  31. {
  32. //Sum S = new Sum();
  33.  
  34. System.out.println(S.sum(1,2));
  35. System.out.println(S.sum(0,2,2));
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement