这样可以为什么这样就不可以了呢
1    
 class   a    
 {    
 a   A=new   a();    
 a()    
 {    
 }    
 oid   c()    
 {    
 }    
 }    
 class   b    
 {    
 a   B;    
 void   f()    
 {    
 B.c();//这是可以的。    
 }    
 }      
 2    
 class   a    
 {a   A=new   a();    
 a()    
 {    
 }    
 void   c()    
 {    
 }    
 }    
 class   b    
 {    
 a   B;    
 public   static   void   main(String[]args    
 {   //这加入a   B;   也是不可以的呢    
 B.c();//这是不可以的    
 }    
 } 
 3    
 class   a    
 {a   A=new   a();    
 a()    
 {    
 }    
 void   c()    
 {    
 }    
 }    
 class   b    
 {    
 public   static   void   main(String[]args    
 {   a   B;    
 B.c();//这是不可以的    
 }    
 }    
 4    
 class   a    
 {a   A=new   a();    
 a()    
 {    
 }    
 void   c()    
 {    
 }    
 }    
 class   b    
 {    
 public   static   void   main(String[]args    
 {   a   B=new   a();    
 B.c();   //这是可以的为什么以上的都不行就1和这个行呢?    
 }    
------解决方案--------------------1.类的成员方法要通过类的实例变量来调用 
 正如: "4. " a类先实例化一个B对象(a B=new a()),在通过该对象来调用其c()方法(B.c()).而 "3. "中与这个是违背的   
 2. "1 "lz说的 "可以 "只是编译可以通过! 
 代码改写成如下,运行时,会报NullPointer异常,道理如 "1 " 
 class a  
 {  
 	a A=new a();  
 	a() {  
 	}  
 	void c() {  
 		System.out.println( "dfdfdf "); 
 	}  
 }    
 class b  
 {  
 	a B;  
 	void f()  
 	{  
 		B.c();//这是可以的。  
 	}  
 	public static void main(String[] args){ 
 		b test = new b(); 
 		test.f(); 
 	} 
 }  
 3.以后类名能不能不小写,lz应该继续学习oop的基本概念 
 4.技术交流:http://programmer365.blog.163.com/
------解决方案--------------------因为你 
 代码太乱 
 语法错误太多 
 分太少 
 问题太多
------解决方案--------------------1  
 class a  
 {  
   a A=new a();  
   a()  
   {  
   }  
   oid c()  
   {  
   }  
 }  
 class b  
 {  
   a B;  
   void f()  
   {  
     B.c();//这是可以的。 //编译可以通过,因为B是a的实例所以可以调用方法,当然无法运行 
   }  
 }    
 2  
 class a  
 { 
   a A=new a();  
   a()  
   {  
   }  
   void c()  
   {  
   }  
 }  
 class b  
 {  
   a B;  
   public static void main(String[]args  
   { //这加入a B; 也是不可以的呢  
     B.c();//这是不可以的 //静态方法无法调用非静态类成员(这里的B不是静态的) 
   }  
 } 
 3  
 class a  
 { 
   a A=new a();  
   a()  
   {  
   }  
   void c()  
   {  
   }  
 }  
 class b  
 {  
   public static void main(String[]args  
   {  
     a B;  
     B.c();//这是不可以的 //非在类成员中定义的变量必须初始化,之前的B不用初始化是因为编译器会给他一个默认值null 
   }  
 }  
 4  
 class a  
 { 
   a A=new a();  
   a()  
   {  
   }  
   void c()  
   {  
   }  
 }  
 class b