<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">public class chap4 {

  
  public static void main(String args[]) {
    
    int a,b,c;
    Data temp1,temp2;

    a = 1;
    temp1 = new Data(1);
    temp2 = new Data(3);
    b = temp1.value;
    c = temp2.value;

    System.out.println("Current values");
    System.out.println("a: " + a);
    System.out.println("b: " + b);
    System.out.println("c: " + c);
    System.out.println();

    change(a,temp1,temp2);
    b = temp1.value;
    c = temp2.value;

    System.out.println("Values after method");
    System.out.println("a: " + a);
    System.out.println("b: " + b);
    System.out.println("c: " + c);
    System.out.println();
  }

  public static void change(int formal1, Data formal2, Data formal3) {

    System.out.println("Before changing values inside method");
    System.out.println("Formal1: " + formal1);
    System.out.println("Formal2: " + formal2.value);
    System.out.println("Formal2: " + formal3.value);
    System.out.println();

    formal1 = 2;
    formal2.value=2;
    formal3 = new Data(4);

    System.out.println("After changing values inside method");
    System.out.println("Formal1: " + formal1);
    System.out.println("Formal2: " + formal2.value);
    System.out.println("Formal3: " + formal3.value);
    System.out.println();
  }

}


class Data {
    
    int value;
    Data(int input) {
      value = input;
    }
  }


</pre></body></html>