java用二维数组打印平面直角坐标系
展开全部
public class Rect { private int x; private int y; private int width; private int height; public int getX() { return x; } public int getY() { return y; } public int getWidth() { return width; } public int getHeight() { return height; } public Rect(int x,int y,int width,int height){ this.x=x; this.y=y; this.width=width; this.height=height; } public void getArea(){ System.out.println("面积:"+this.width+"*"+this.height+"="+this.width*this.height); } public void print(){ System.out.println("坐标点("+getX()+","+getY()+")"); System.out.println("长:"+getWidth()); System.out.println("宽:"+getHeight()); } public static void main(String[] args){ Rect rect=new Rect(50,50,100,50); rect.getArea(); rect.print(); }}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询