Eclipse displays a "Super Interface Must Be an Interface" type of error message

Asked 1 years ago, Updated 1 years ago, 277 views

Does the error message "Super interface must be interface" appear in Eclipse in java? How can I fix it so that it can be compiled?
The error is the source code you are experiencing

java

2022-09-30 21:53

3 Answers

The code included in the question image is

public class SampleImplementations Sample 

It says

This means "The class SampleImp is an implementation of the interface Sample".

If you get the "Must be an interface" error here, it's probably because Sample is not an interface (because only the first code you write is using (implementing) the interface).

==
 You don't know how to fix it because you don't have enough knowledge of the questioner's classes and interfaces.
 To solve this problem, you should read a few books or Mooks named "First Java" carefully.If you have problems with those books, solving them by yourself will help you learn a lot.

It's good to study on a page like Kunif is introduced, but if possible, please study on a book or a Mook.
 This is because books and Mooks are more comprehensive about Java.

Good luck!
 


2022-09-30 21:53

Open Sample.java and define it as an interface as follows:

package chapter1.chapter2;

public interface Sample {
}

In Eclipse, when defined as an interface, the icon is marked I on the right shoulder.
However, this is not the case in the image in the questionnaire.
It is probably class instead of interface.

Enter a description of the image here


2022-09-30 21:53

I can't see the full code, so I'll answer with my answer is
Rewrite line 3 "implementations" to "extends".

As for the questioner, the implementation of the interface and the inheritance of the class seem to be mixed up.
To understand the cause
·What is an interface
·Implementation of interface
·What is a class
·Succession of classes
I think it's better to search around.


2022-09-30 21:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.