Question: Here are three overloaded constructors for a class named Rect 2 D . public Rect 2 D ( ) { this.x = 0 . 0

Here are three overloaded constructors for a class named Rect2D.
public Rect2D(){
this.x =0.0;
this.y =0.0;
this.color = Color.RED;
}
public Rect2D(Color c){
this.x =0.0;
this.y =0.0;
this.color = c;
}
public Rect2D(double x, double y, Color c){
this.x = y;
this.y = x;
this.color = c;
}
I instantiate a few versions of the class as follows:
Rect2D square1= new Rect2D();
Rect2D square2= new Rect2D(Color.BLUE);
Rect2D square3= square2;
Which of the following statements are guaranteed to be true based on the given information?
Question 3 options:
square1== square2
square2== square3
Two out of three squares are RED
Two out of three squares are BLUE
square1 is BLUE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!