package com.hanqi.test; public class Point { private int x; private int y; Point(int xx,int yy) { x=xx; y=yy; } public int getX() { return x; } public int getY() { return y; } }
Point pt=new Point(1,2); System.out.println("x值是"+pt.getX()+"y的值是"+pt.getY());