Single Choice Not Set

Qwhat 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();
        }
}

ID: #2237 Overriding and Overloading in Java 2,680 views
Question Info
#2237Q ID
Not SetDifficulty
Overriding and Overloading in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • 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

Explanation

I am a Student

Share This Question

Challenge a friend or share with your study group.