看了网上的相关资料,写了一个接口继承的程序,其中一段:继承接口Prompts<%@ page import="com.businessobjects.rebean.wi.Prompt" %> 
<%@ page import="com.businessobjects.rebean.wi.Prompts" %> 
...
<% public class myPrompts implements Prompts
  {
     public Prompt getItem(String s){}     
     public Prompt getItem(int i){}
     public int getCount(){}
  } %>
说明:getItem(String s),getItem(int i),getCount()三个方法是Prompts有的myPrompts位置报错:Illegal modifier for the local class myPrompts; only abstract or final is 
 permitted

解决方案 »

  1.   

    接口是用来实现的,不叫继承,把实现的那个接口里的方法写好,是有返回类型的,
     public Prompt getItem(String s){}    
        public Prompt getItem(int i){} 
        public int getCount(){} 如果不实现你也得在有返回类型的反法里来一句:return null;
      

  2.   

    报错说应该将myPrompts的修饰符声明为abstract或final的
    你实现了接口Prompts中的所有方法吗?getItem(String s),getItem(int i),getCount()三个方法是Prompts接口中仅有的3个方法吗?
      

  3.   


    getItem(String s),getItem(int i),getCount()是Prompts接口中仅有的3个方法
      

  4.   


    加了“return null;”,报同样错误
      

  5.   

    public int getCount(){} 
     不能用 return null用 return 1
      

  6.   

    既然是implements那么就得实现那个接口的所有方法,不能public Prompt getItem(String s){} 没有返回值出现
      

  7.   

    继承的话应该这么写public interface myPrompts extends Prompts {
        public Prompt getItem(String s);
        public Prompt getItem(int i) ;
        public int getCount();
    }