Missing Method body, or declare abstract

后端 未结 2 1330
梦如初夏
梦如初夏 2021-01-28 04:55

I am getting this error message:

Exception in thread \"main\" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Pet.saySomething

2条回答
  •  走了就别回头了
    2021-01-28 05:43

    You have the following options for Speak, take your pick:

    1st

    public abstract class Speak{
    
       public abstract void saySomething();
    
    }
    

    2nd

    public class Speak{
    
       public void saySomething(){
    
       }
    }
    

    3rd

    public interface Speak{
    
       public void saySomething();
    }
    

    Edit: First of all, you are not using Speak class anywhere. Second, please add the following method in Pet class:

     public abstract void saySomething();
    

提交回复
热议问题