package zh.codegym.task.task05.task0513;
/*
我们来组合一个矩形
*/
public class Rectangle {
private int left;
private int top;
private int width;
private int height;
public void initialize(int left,int top,int width,int height){
this.left=left;
this.top=top;
this.width=width;
this.height=height;
}
public void initialize(int left,int top){
this.left=left;
this.top=top;
this.width=0;
this.height=0;
}
public void initialize(int left,int top,int width){
this.left=left;
this.top=top;
this.width=width;
this.height=width;
}
//public void initialize(Rectangle file,int left,int top,int width){
//how to write this part method to create a copy of third initialize(...) method?
}
//在此编写你的代码
public static void main(String[] args) {
}
}
how to write the last initialize(...) method?
已解决
评论 (4)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
Yoosen
5 八月 2020, 09:21
You can refer to my answer. I'm not sure I'm right
0
alittleblank
13 七月 2020, 09:33
public class Rectangle {
//在此编写你的代码
public int top;
public int left;
public int width;
public int height;
public void initialize(int top){
this.top=top;
}
public void initialize(int top, int left){
this.top=top;
this.left=left;
}
public void initialize(int top, int left, int width){
this.top=top;
this.left=left;
this.width=width;
}
public void initialize(int top, int left, int width, int height){
this.top=top;
this.left=left;
this.width=width;
this.height=height;
}
public static void main(String[] args) {
}
}
-2
单身狗
11 七月 2020, 06:17
package zh.codegym.task.task05.task0513;
/*
我们来组合一个矩形
*/
public class Rectangle {
//在此编写你的代码
int left;
int top;
int width;
int height;
public static void main(String[] args) {
}
public void initialize(int left){
// this.left=left;
}
public void initialize(int left,int top){
// this.left=left;
// this.top=top;
}
public void initialize(int left,int top,int width){
// this.left=left;
// this.top=top;
// this.width=width;
}
public void initialize(int left,int top,int width,int height){
// this.left=left;
// this.top=top;
// this.width=width;
// this.height=height;
}
}
-4
Let's play video games
12 七月 2020, 03:13
are you sure your solution is right?
0