You are not logged in.

#1 2015-06-13 05:00:04

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

Compilation Fails:

Java Quizzes Java Language Interfaces And Abstract Classes

Directions:
1. public interface InfA{
2.       protected String getName();
3. }

public class Test implements InfA{
      public String getName(){
            return "test-name";
      }
      public static void main (String[] args){
            Test t = new Test();
            System.out.println(t.getName());
      }
}

Question:
What will be the output?

Option A):
Compilation succeed but Runtime Exception
Option B):
Compilation fails due to an error on lines 1
Option C):
test-name
Option D):
Compilation fails due to an error on lines 2

Correct Answer is Option D):
Compilation fails due to an error on lines 2


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

2015-06-13 05:00:04

Advertisement
Ads By Google

Re: Compilation Fails:



\n

Board footer