public class Rectangle {
int left;
int top;
int width;
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;
width = 0;
height = 0;
}
public void initialize(int left, int top , int width){
this.left = left;
this.top = top;
this.width = width;
height = width;
}
public void initialize(initialize(int left, int top, int width, int height)){
this.left = left;
this.top = top;
this.width = width;
this.height = height;
}
public static void main(String[] args) {
}
}
help please...what cause error in copy method
Under discussion
Comments (10)
- Popular
- New
- Old
You must be signed in to leave a comment
Khurram
25 September 2018, 06:19
the parameter for copy rectangle is a Rectangle object
0
Shahanshah Alam
25 September 2018, 06:33
what does it mean...i didn't get it
any syntax to understand
thanks
0
Khurram
25 September 2018, 06:48
https://codegym.cc/quests/lectures/questsyntax.level05.lecture06
study the code for "Create a copy next to the current file", the third initialize method
0
Shahanshah Alam
25 September 2018, 07:25
public class Rectangle {
int left;
int top;
int width;
int height;
private int number = 0;
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;
width = 0;
height = 0;
}
public void initialize(int left, int top , int width){
this.left = left;
this.top = top;
this.width = width;
height = width;
}
public void initialize(int left){
this.number = left;
}
public void initialize(int left, int height){
this.number = top + height;
}
public static void main(String[] args) {
Rectangle r = new Rectangle();
r.initialize(2);
}
}
0
Shahanshah Alam
25 September 2018, 07:26
i have initialized 1 parameter 2 , 3 , 4 parameter method
in last method what should i do
0
Khurram
25 September 2018, 07:34
in the copy initialize method, passed parameter should be an object of Rectangle class
0
Shahanshah Alam
25 September 2018, 07:42
i m not getting can you give me coode for that portion please...
i know its not legal but i m not getting it bro...
0
Khurram
25 September 2018, 07:50
public void initialize(Rectangle anotherRectangle)
{
// initialize here
}
0
Shahanshah Alam
25 September 2018, 07:56
finally done
thanks a lot bro
0
shovan
20 October 2018, 14:56
can u help me brother,i cant initialize the copy rectangle
0