作者在 2006-07-28 09:12:00 发布以下内容
class Point
{
final double PI;
Point()
{
PI=3.1415926;
}
Point(int a,int b)
{
PI=4.1415926;
}
void output()
{
System.out.println(PI);
}
public static void main(String[] args)
{
Point pt;
pt=new Point();
pt.output();
Point pt2=new Point(2,3);
pt2.output();
}
}
//结论:不同构造函数中定义常量值可以不同
{
final double PI;
Point()
{
PI=3.1415926;
}
Point(int a,int b)
{
PI=4.1415926;
}
void output()
{
System.out.println(PI);
}
public static void main(String[] args)
{
Point pt;
pt=new Point();
pt.output();
Point pt2=new Point(2,3);
pt2.output();
}
}
//结论:不同构造函数中定义常量值可以不同