ควิซ 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.

ปานกลาง 10 ข้อ ~6 นาที ผ่านที่ 80% Java 17

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

ตัวอย่างคำถาม

ข้อ 1 จาก 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());
    }
}
ดูเฉลย

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.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • 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

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง