Question: The following classes are defined in a program: class Person { public void speak() { System.out.println(Person:: speak() called); } } class Nick extends Person {

 The following classes are defined in a program: class Person {public void speak() { System.out.println("Person:: speak() called"); } } class Nick extends

The following classes are defined in a program: class Person { public void speak() { System.out.println("Person:: speak() called"); } } class Nick extends Person { public void speak() { System.out.println("Nick::speak() called"); } } What will be displayed when the following code is executed? Person p = new Nick(); p.speak(); Person::speak() called None of the answers are correct O Person::speak() called Nick::speak() called Nick::speak() called O Nick::speak() called Person::speak() called

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!