i am not getting
please can anyone send me the code
and also check my code where is mistake.
package com.codegym.task.task05.task0520;
/*
Create a Rectangle class
*/
public class Rectangle {
//write your code here
int top,left,width,height;
public void initialize(int top,int left,int width,int height)
{
this.top = top;
this.width = width;
this.left = left;
this.height = height;
}
public void initialize(int top,int left)
{
this.top = top;
this.left = left;
this.width = 0;
this.height = 0;
}
public void initialize(int top,int left,int width)
{
this.top = top;
this.left = left;
this.width = width;
this.height = height;
}
public void initialize(Rectangle rec(int top,int left,int width,int height))
{
this.top = top;
this.left = left;
this.width = width;
this.heigth =height;
}
public static void main(String[] args) {
}
}
please help me, i am not getting from a long time
Under discussion
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
Sergei Polakov
5 March 2019, 17:27
package com.codegym.task.task05.task0520;
/*
Create a Rectangle class
*/
public class Rectangle {
private int left;
private int top;
private int width;
private int height;
public Rectangle(int left)
{
this.left = left;
}
public Rectangle(int left, int top)
{
this.top = top;
this.left = left;
}
public Rectangle(int left, int top, int width)
{
this.top = top;
width = 0;
this.left = left;
}
public Rectangle(int left, int top, int width, int height)
{
this.top = top;
width = 0;
this.left = left;
height = 0;
}
public void initialize(Rectangle tempRec){
tempRec.left = left;
tempRec.top = top;
height = 0;
width = 0;
}
public static void main(String[] args) {
}
}
+2
Alkashree Jha
19 February 2019, 12:39
create constructor as per condition mentioned.
0
carolina
16 February 2019, 18:30
int top,left,width,height; <-- You must write the word public or private before declare the variable,
Example: public int / String / whatever or private int / String / whatever... this class explains that: https://codegym.cc/quests/lectures/questsyntax.level05.lecture04, also you can google it, there are a lot of information about it. Let me know if you can do the exercise, I'm new in this too but i'll help you if I can.
0
Guadalupe Gagnon
15 February 2019, 15:59
Problems:
+2