Mcq - Interfaces In Java

11. Which of these can be used to fully abstract a class from its implementation?

A. Objects
B. Packages
C. Interfaces
D. None of the Mentioned

View Answer


12. What is the output of this program?

 interface calculate
 {
  void cal(int item);
 }
 class display implements calculate
  {
   int x;
   public void cal(int item)
    {
    x = item * item;
    }
  }
 class interfaces
  {
   public static void main(String args[])
   {
    display arr = new display;
    arr.x = 0;
    arr.cal(2);
    System.out.print(arr.x);
   }
  }

A. 0
B. 2
C. 4
D. None of the mentioned

View Answer


13.All methods must be implemented of an interface.

A. True
B. False

View Answer


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

A. public static
B. private final
C. public final
D. static final

View Answer


15. What does an interface contain?

A. Method definition
B. Method declaration
C. Method declaration and definition
D. Method name

View Answer







Also check :


Discussion


* You must be logged in to add comment.