cloning

Quiz Guidelines

 

Descriptive Question

QID: 
44

Find output:

public class MyClass {

  int id;

  public static void main(String[] args) throws Exception {

    MyClass mc = new MyClass();

    mc.id=10;

    System.out.println(((MyClass)mc.clone()).id);

  }

}

 

Descriptive Question

QID: 
43

Find output:

public class MyClass {

  int id;

  public static void main(String[] args) throws Exception {

    MyClass mc = new MyClass();

    mc.id=10;

    System.out.println(mc.clone().id);

  }

}