Multiple choice technology programming languages

Which declare a compilable abstract class? (Choose all that apply.)

  1. public abstract class Canine { public Bark speak(); }

  2. public abstract class Canine { public Bark speak() { } }

  3. public class Canine { public abstract Bark speak(); }

  4. public class Canine abstract { public abstract Bark speak(); }

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

For abstract classes in Java: A is invalid - method 'speak()' has no body and no abstract modifier. B is valid - method has empty body (braces), concrete implementation in abstract class is fine. C is invalid - non-abstract class cannot have abstract method. D is invalid - 'abstract' keyword must come before 'class', not after. Only B declares a compilable abstract class.