Java-Quiz: Abstract Classes & Interfaces

This Java quiz checks how abstract classes and interfaces define contracts for other classes. You will predict output with abstract methods, default methods and lambdas, and spot the rules the compiler enforces when you implement them.

Mittel 10 Fragen ~6 Minuten Bestanden ab 80% Java 17

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 10

What happens when you compile and run this?

public class Main {
    static abstract class Shape {
        abstract double area();
    }

    public static void main(String[] args) {
        Shape s = new Shape();
        System.out.println(s.area());
    }
}
Lösung zeigen

A. Compile error An abstract class cannot be instantiated with new, because some of its methods have no body. You create a concrete subclass, or an anonymous class, instead.

Darum geht es in diesem Quiz

  • Abstract classes and abstract methods
  • Interfaces, default methods and constants
  • Implementing interfaces with public methods
  • Functional interfaces and lambdas
  • Choosing between an abstract class and an interface

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.