Java Quiz Day 19

Last Updated :
Discuss
Comments

Question 1

Which of the following is NOT true about interfaces?

  • Can contain default methods


  • Can contain constructors

  • Can be implemented by multiple classes

  • Can contain static methods

Question 2

What is the main difference between class and interface?


  • Class can’t have variables

  • Interface can be instantiated

  • Interface can’t have method bodies (pre Java 8)

  • Class has only abstract methods

Question 3

Which Java feature allows multiple inheritance of type?


  • Interface


  • Abstract class


  • Inheritance

  • Static block


Question 4

Which annotation is used to declare a functional interface?


  • @Functional


  • @Interface

  • @Override


  • @FunctionalInterface


Question 5

How many abstract methods can a functional interface have?


  • 0

  • 1

  • 2

  • Unlimited

Question 6

Which of the following is a valid functional interface in Java?

  • Comparator

  • Runnable


  • Callable

  • All of the above


There are 6 questions to complete.

Take a part in the ongoing discussion