Question: class Patient { String name; int height; void updateHeight(int newHeight) { height = newHeight; } // constructor (says how to initialize a new Patient) Patient(String

class Patient {

String name;

int height;

void updateHeight(int newHeight) {

height = newHeight;

}

// constructor (says how to initialize a new Patient)

Patient(String n, int h) {

name = n;

height = h;

}

}

class Doctor {

void checkup(Patient p) {

Patient p2 = new Patient(p.name, p.height+10);

p = p2;

}

public static void main(String[] args) {

Doctor d = new Doctor();

Patient georgia = new Patient("Georgia", 71);

d.checkup(georgia);

System.out.println(georgia.height);

}

}

What does the program print to the console?

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!