Question: Consider the following code. What will print out when this code is run? public class Polymorphism Demo { public static void main(String[] args) { m(new
Consider the following code. What will print out when this code is run? public class Polymorphism Demo { public static void main(String[] args) { m(new Graduate Student()); m(new Student); m(new Person(); m(new Object(); public static void m(Object ) { System.out.println(x.toString(); class Graduate Student extends Student class Student extends Person { public String toString({ return "Student": class Person extends Object ( public String toStringo return "Person
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
