Home » JAVA Programming » Interfaces » Question
  1. What is the correct option with regards to below snippet?
    interface NewCustomer 
    {
    }
    class RegCustomer implements NewCustomer
    {
    }
    class QuickCustomer implements NewCustomer
    {
    }
    1. QuickCustomer can be replaced with RegCustomer
    2. We can instantiate objects of NewCustomer
    3. NewCustomer can be replaced with RegCustomer
    4. RegCustomer can be replaced with QuickCustomer
    5. None of these
Correct Option: C

According to Liskov substitution principle we can replace NewCustomer with RegCustomer or QuickCustomer without affecting functionality.



Your comments will be displayed only after manual approval.