码迷,mamicode.com
首页 > 编程语言 > 详细

Java练习题4_3_2407林大锐格平台

时间:2017-04-14 16:13:00      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:turn   private   can   getx   obj   system   div   int   rgs   

import java.util.Scanner;
class Rectangular {
    private static int x, y;
    private static int countP = 0;

    public Rectangular(int xx, int yy) {
		 x=xx;
		 y=yy;
		 
	}

	public Rectangular(Rectangular p) {
		x=p.x;
		y=p.y;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public static void GetC() {
		countP++;
		System.out.println("Object id=" + countP+" X*Y = "+ (x*y));
	}

}

public class Main {
	public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	Rectangular A=new Rectangular(sc.nextInt(),sc.nextInt());
	A.GetC();
	Rectangular B=new Rectangular(A);
	B.GetC();
	}
}

 

Java练习题4_3_2407林大锐格平台

标签:turn   private   can   getx   obj   system   div   int   rgs   

原文地址:http://www.cnblogs.com/lijunzone/p/6709338.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!