НЕ понимаю, как копировать объект
package com.javarush.task.task05.task0520;
/*
Создать класс прямоугольник (Rectangle)
*/
public class Rectangle {
int left, top, width, height; //напишите тут ваш код
public Rectangle(int a, int b, int c, int d){
this.left = a;
this.top = b;
this.width = c;
this.height = d;
}
public Rectangle(int a, int b){
this.left = a;
this.top = b;
}
public Rectangle(int a){
this.left = a;
this.top = a;
}
public Rectangle(Rectangle rectangle1){
//this(rectangle1);
left = rectangle1.left;
top = rectangle1.top;
width = rectangle1.width;
height = rectangle1.height;
}
public static void main(String[] args) {
Rectangle rectangle1 = new Rectangle(1, 2, 3, 4);
Rectangle rectangle2 = new Rectangle(0, 0);
Rectangle rectangle3 = new Rectangle(1);
Rectangle rectangle4 = new Rectangle(Rectangle);
}
}