Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions