Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package com.mid;
  2.  
  3. public class B1 {
  4. public static int x = 2;
  5. public static int temp = 1;
  6. private int sum = 0;
  7. private int y = 2;
  8. public B1(){
  9. y = temp + 3 ;
  10. sum = 3 + temp + 2;
  11. temp -= 2;
  12. methodA(1, 2);
  13. }
  14. public B1(B1 b){
  15. System.out.printf("y: %d\n", this.y);
  16. sum = b.sum;
  17. x = b.x;
  18. b.methodB(2, 3);
  19. }
  20. public void methodB(int m, int n){
  21. int y = 0;
  22. y = y + this.y;
  23. x = this.y + 2 + temp;
  24. methodA(x, y);
  25. sum = x + y + sum;
  26. System.out.println(x + " " + y+ " " + sum);
  27. }
  28. public void methodA(int m, int n){
  29. int x = 0;
  30. System.out.printf("x: %d, n: %d\n", x, n);
  31. y = y + m + (temp++);
  32. x = x + 2 + n;
  33. System.out.printf("x: %d, n: %d\n", x, n);
  34. sum = sum + x + y;
  35. System.out.println(x + " " + y+ " " + sum);
  36. }
  37. public static void main(String[] args) {
  38. B1 b1 = new B1();
  39. B1 b2 = new B1(b1);
  40. b2.methodB(3, 2);
  41.  
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement