标签: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();
}
}
标签:turn private can getx obj system div int rgs
原文地址:http://www.cnblogs.com/lijunzone/p/6709338.html