 
		寂寞追不上我
2016-03-27 22:41
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("有参构造函数执行了"+screen);
	}*/
} 
				print()和Telephone phone3= new Telephone()形成循环了
 
				因为它默认是去调用Telphone这个类了。而不是Telphone这个方法。
 
				public static void main(String[] args) {
System.out.println(Telephone.a);
System.out.println("zzw");
print();
}
Java入门第二季
531292 学习 · 6327 问题
相似问题