[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

JAVA Programming :: Inheritance - Discussion

Home > JAVA Programming > Inheritance > MCQs Questions Discussion

7 / 9

What is the output for the below code?

public interface InfA {
protected String getName();
}
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());
}
}

Atest-name

BCompilation fails due to an error on lines 2

CCompilation fails due to an error on lines 1

DCompilation succeed but Runtime Exception

Answer: Option (Login/Signup)

Show Explanation

Asked In ::

Post Your Answer Here:     

No Discussion on this question yet!