好心人帮个忙
1) 设计一个Point类,该类包含两个int型成员变量:x、y,一个color型成员变量mycolor。请给出此类的构造方法,分别是一个不带参数的,一个带两个参数的,一个带三个参数的构造方法。还要给出对应的get方法和set方法,最后重写equals和toString方法。
package cn.dadongzicool.point;
import java.awt.Color;
public class Point {
int x,y;
Color myColor;
public Point() {
super();
// TODO Auto-generated constructor stub
}
public Point(int x, int y) {
super();
this.x = x;
this.y = y;
}
public Point(int x, int y, Color myColor) {
super();
this.x = x;
this.y = y;
this.myColor = myColor;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public Color getMyColor() {
return myColor;
}
public void setMyColor(Color myColor) {
this.myColor = myColor;
}
public boolean equals(Object obj) {
return myColor.equals(obj);
}
public String toString() {
return myColor.toString();
}
}