- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di Java: 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.
Domanda di esempio
Domanda 1 di 10What 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());
}
}
Mostra la risposta
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.
Cosa copre questo quiz
- Abstract classes and abstract methods
- Interfaces,
defaultmethods and constants - Implementing interfaces with
publicmethods - Functional interfaces and lambdas
- Choosing between an abstract class and an interface
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.