java创建泡泡糖类和泡泡糖的坐标类
时间: 2023-12-25 10:02:51 浏览: 70
泡泡糖类:
```java
public class BubbleGum {
private String color;
private int size;
public BubbleGum(String color, int size) {
this.color = color;
this.size = size;
}
public String getColor() {
return color;
}
public int getSize() {
return size;
}
}
```
泡泡糖坐标类:
```java
public class BubbleGumLocation {
private int x;
private int y;
public BubbleGumLocation(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
}
```
阅读全文