A

Admin • 828.43K Points
Coach

Q. what is the result of the following piece of code:
public class Person{
public void talk(){
System.out.print("I am a Person");
}
}

public class Student extends Person{
public void talk(){
System.out.print("I am a Student");
}
}

public class Test{
public static void main(String args[]){
Person p = new Student();
p.talk();
}
}

  • (A) I am a Person
  • (B) I am a Student
  • (C) I am a Person I am a Student
  • (D) I am a Student I am a Person
  • Correct Answer - Option(B)
  • Views: 13
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.