What happen when you compile and run the following program:
public class X implements Cloneable
{
public X(String name) {this.name = name;}
public Object clone() throws CloneNotSupportedException
{
return super.clone();
}
public String name;
public static void main(final String[] args) throws CloneNotSupportedException
{
final X x1 = new X("x1");
final X x2 = (X) x1.clone();
System.out.println("x1.equals(x2) is " + x1.equals(x2));
System.out.println("x1.name == x2.name is " + (x1.name == x2.name));
}
}
A) Error "main(final String[] args) cannot throw checked exceptions"
B) Output "x1.equals(x2) is true" and "x1.name == x2.name is true"
C) Output "x1.equals(x2) is false" and "x1.name == x2.name is true"
D) Output "x1.equals(x2) is false" and "x1.name == x2.name is false"
E) Output "x1.equals(x2) is true" and "x1.name == x2.name is false"