You are not logged in.
Pages:: 1
#1 2015-06-13 05:03:42
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.
Offline
2015-06-13 05:03:42
- Advertisement
- Ads By Google
Re: Class Test Implements:
\n
Pages:: 1