典型的java面向对象的程序架构
源程序:
class Point
{
int x,y;
Point(int a,int b)
{
x=a;
y=b;
}
void show()
{
System.out.print(x+" ");
System.out.print(y+" ");
System.out.println(); //换行
}
}
public class a12_29 {
public static void main(String []args)
{
Point p1,p2;
p1=new Point(10,10);
p2=new Point(23,35);
p1.show();
p2.show();
}
}