public?class?Telephone?{
//屬性
public?static?int?a?=?15;
float?screen;
float?cpu;
float?memory;
int?var?=?20;
//方法
public?void?show(){
System.out.println("1994");
}
public?static?void?print(){
System.out.println("1996");
System.out.println(a);
????Telephone?phone3=?new?Telephone();
????System.out.println(phone3.var);
}
public?Telephone(){
System.out.println(Telephone.a);
System.out.println("zzw");
print();
}
/*public?Telephone(float?newScreen,float?newCpu,float?newMemory){
screen=newScreen;
cpu=newCpu;
memory=newMemory;
System.out.println("有參構(gòu)造函數(shù)執(zhí)行了"+screen);
}*/
}
2016-03-27
print()和Telephone?phone3=?new?Telephone()形成循環(huán)了
2016-03-27
因為它默認是去調(diào)用Telphone這個類了。而不是Telphone這個方法。
2016-03-27
? ?public static void main(String[] args) {
? ? ? ?System.out.println(Telephone.a);
? ? ? ?System.out.println("zzw");
? ? ? ?print();
}
? ? ? ??
? ??