You are not logged in.

#1 2015-06-13 05:03:42

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Class Test Implements:

Java Quizzes Java Language Interfaces And Abstract Classes

Directions:
interface MyInterface{
      void display();
}

interface MySubInterface extends MyInterface{
      void display();
}

public class Test implements MySubInterface{
      public void display(){
            System.out.print("Welcome to Examveda.");
      }
      public static void main(String args[]){
            Test t = new Test();
        t.display();
      }
}

Question:
What happens if the following program is compiled and executed?

Option A):
The code will compile and execute successfully showing the output Welcome to Examveda
Option B):
The code will lead to a compilation error due to public modifier while declaring the display method
Option C):
The code will lead to a compilation error as the display method is not declared as abstract
Option D):
The code will lead to a compilation error as declaration of the display method has been provided in two interface

Correct Answer is Option A):
The code will compile and execute successfully showing the output Welcome to Examveda


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-13 05:03:42

Advertisement
Ads By Google

Re: Class Test Implements:



\n

Board footer