Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mid;
- public class B1 {
- public static int x = 2;
- public static int temp = 1;
- private int sum = 0;
- private int y = 2;
- public B1(){
- y = temp + 3 ;
- sum = 3 + temp + 2;
- temp -= 2;
- methodA(1, 2);
- }
- public B1(B1 b){
- System.out.printf("y: %d\n", this.y);
- sum = b.sum;
- x = b.x;
- b.methodB(2, 3);
- }
- public void methodB(int m, int n){
- int y = 0;
- y = y + this.y;
- x = this.y + 2 + temp;
- methodA(x, y);
- sum = x + y + sum;
- System.out.println(x + " " + y+ " " + sum);
- }
- public void methodA(int m, int n){
- int x = 0;
- System.out.printf("x: %d, n: %d\n", x, n);
- y = y + m + (temp++);
- x = x + 2 + n;
- System.out.printf("x: %d, n: %d\n", x, n);
- sum = sum + x + y;
- System.out.println(x + " " + y+ " " + sum);
- }
- public static void main(String[] args) {
- B1 b1 = new B1();
- B1 b2 = new B1(b1);
- b2.methodB(3, 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement