Class Rectangle is defined as:
class Rectangle {
public Rectangle(int l, int w) {
length = l;
width = w;
}
public int length;
public int width;
}
An object of type Rectangle is created and its reference r1 is assigned to another reference r2.
Rectangle r1 = new Rectangle(50,30);
Rectangle r2 = r1;
What will be the result of equality comparison r1 == r2 after modifying r2.length:
// modify r2.length
r2.length = 55;
// compare and print result
System.out.println( r1 == r2 ? "Equal" : "Not Equal");