类的调用:
1、变量名.方法 前提:实例
2、类名.方法 前提:static
//变量名.实例
public class P
{
public double getP()
{
return 0;
}
}
P P1=new P;
System.out.println(P1.getP());
//类名.方法 static
public class P()
{
public static duoble getP()
{
return 0;
}
}
System.out.println(P.getp());