ERROR - The type SuperBuggyBread cannot be the superclass of BuggyBread1; a superclass must be a class

Error

The method forEach(Consumer<? super Integer>) in the type Iterable<Integer> is not applicable for the arguments (Predicate<String>)

while using forEach and Lambda Expressions in Java 8.

Error Type


Compile Time


Sample Code


public class BuggyBread1 extends SuperBuggyBread{
    public static void main (String args[]) {
    }    
}

Cause

SuperBuggyBread is not a class. It might be an Interface or an Enum. 

Resolution

Enum types are final by design so they cannot be extended.


Interfaces can be implemented using implements instead of extends.

Make sure that SuperBuggyBread is either a class or implement it if its an interface.'