Which is the first line to fail to compile?
class Shape { default void use() { } // r1 } class Rectangle extends Shape { public void use() { } // r2 public void bang() { } // r3 }
A.
While there is a default keyword in Java, it is only allowed in interfaces or in switch statements.
It is not a visibility modifier.
The author of this code probably intended for the method to be package-private, which doesn't use a visibility modifier.
The line with default doesn't compile, so Option A is correct.
If default was removed, the code would all compile.