Question: You are given the below Java code: 1 public class Student { 2 4 6 7 public String name; public double gpa; @Override public


You are given the below Java code: 1 public class Student {

You are given the below Java code: 1 public class Student { 2 4 6 7 public String name; public double gpa; @Override public String toString() { return "Student"; } 8 } 9 10 public class Graduate Student extends Student{ public int age; @Override public String toString() { 11 12 13 14 } 15 } return "Graduate Student"; 16 public class MainClass{ 17 18 19 20 21 public static void main(String[] args) { Student A = new Graduate Student(); Graduate Student B = new Graduate Student (); System.out.println (A.toString()); System.out.println(B.toString()); 22 23 a) What will be printed out by line 20 in the above code? [12.5 pts] b) What will be printed out by line 21 in the above code? [12.5 pts]

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 Programming Questions!