package lzhw;public class super 
{
   int a=10;
   void hi()
   {
   System.out.println("hello");
   }
  class sub extends super
  {
       int b=20;
       void hi()
       {
       System.out.println("hi");
      }
       void bye()
       {
       System.out.println("bye");
       }
       }
          public class super{  
public static void main(String[] args) 
{
super ob=new sub();
ob.a=20;
ob.hi();

}
          }
}

解决方案 »

  1.   

    super是关键字吧,不可用来做标识符
      

  2.   

    public class super 

    ……
      

  3.   

    super是关键字,不能作为类名
      

  4.   


    public static void main(String[] args) 

    super ob=new sub(); 
    ob.a=20; 
    ob.hi(); 不止是super是关键字,不能作为类名哦
    你创建内部类对象也不对
    super supe=new super();
    supe.sub ob=supe.new sub(); 而sub extends super 扩展了外部类
     void hi() 
    方法相当于重载了
    LZ要是把上面的错误都改了
    应该可以
      

  5.   

    类名为Test.java
    package lzhw; class Super 

      int a=10; 
      void hi() 
      { 
      System.out.println("hello"); 
      }

      class sub extends Super 
      { 
          int b=20; 
          void hi() 
          { 
          System.out.println("hi"); 
          } 
          void bye() 
          { 
          System.out.println("bye"); 
          } 

              public class Test{  
    public static void main(String[] args) 

    Super ob=new sub(); 
    ob.a=20; 
    ob.hi(); } 
               

      

  6.   

    错误1 super是关键字 不能作为类名
    错误2 内部类调用错误。