Interfaces


  1. What type of variable can be defined in an interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    variable defined in an interface is implicitly final and static. They are usually written in capital letters.


  1. What does an interface contain?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Interface contains the only declaration of the method.



  1. What type of methods an interface contain by default?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    By default, interface contains abstract methods. The abstract methods need to be implemented by concrete classes.


  1. What will happen if we provide concrete implementation of method in interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The methods of interfaces are always abstract. They provide only method definition.



  1. What happens when a constructor is defined for an interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Constructor is not provided by interface as objects cannot be instantiated.