Java OCA OCP Practice Question 2374

Question

Given the following code, which options correctly declare, implement, and extend these interfaces?

interface Printable {}
interface Package {}
interface Shape extends Printable, Package {}
a  class Book implements Shape {}

b  class Container implements Printable {}
   class Bottle extends Container{}

c  interface Box implements Shape {}
   class Fan implements Box {}

d  interface Delivery extends Shape{}
   interface Payment extends Package, Delivery{}
   class Product extends Payment {}


a, b

Note

Option (c) is incorrect, because an interface (Box) can't implement another interface (Shape).

Option (d) is incorrect, because a class (Product) can't extend an interface (Payment).




PreviousNext

Related