Aurora C. Miro, MSCS

  • Write your answer in 1/2 sheet of paper. Show your solution in a columnar form.

    class passing{

    public static void main(String[]args){

    int one;

    IntClass two,three;

    one = 4;

    two = new IntClass(one);

    three = new IntClass(two.getNum());

    System.out.println("In main: ONE = " + one

    + ", TWO =" + two.getNum()

    + ", THREE= " + three.getNum());

    changeData(two,one,three);

    }

    public static void changeData(IntClass x, int y, IntClass z){

    x.setNum(y + z.getNum() * x.getNum());

    z.setNumyes;

    System.out.println("In method changeData : X = " + x.getNum()

    + ", Y = " + y + ", Z = " + z);

    changeAnother(z,y,x);

    }

    public static void changeAnother(IntClass a, int b, IntClass c){

    a.setNum(b + c.getNum() * a.getNum());

    c.setNum(b);

    System.out.println("In method changeAnother: A = " + a.getNum()

    + ", B = " + b + ", C = " + c);

    }

    }