我有一个自定义实体类,它所做的就是创建一个正方形对象。
public class Entity {
Rectangle rect;
public Entity() {
this.rect = new Rectangle(20,20);
rect.relocate(200,200);
}
// I want it to be public Entity getEntity() {return this.rect;}
public Rectangle getEntity() {
return this.rect;
}
}
问题是我无法让类返