Question: Java: Which is correct? The student class has two private fields: name and address. It has a method named print as defined below: public void
Java:
Which is correct?

The student class has two private fields: name and address. It has a method named print as defined below: public void print() System.out.println("Name:" + name Address: + address); > The class P is a subclass of Student; it has a field supervisor of String type. It overrides the print method defined in its superclass. It prints the postgraduate's name and address as well as the name of his/her supervisor. Select the correct definition of the print method in the PG class Select one public void print) System.out.println("Name: " super.name = " Address: *+ super address); System.out.println("Supervisor: " + supervisor); public void print) System.out.println("Name: ".name Address: " address); System.out.println("Supervisor: ".supervisor); o public void print) super.print(); System.out.println("Supervisor: ".supervisor); O public void print Student.print(); System.out.println("Supervisor: " supervisor)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
