Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

looking at the following client, which of the following method(s) take a paramet

ID: 3858873 • Letter: L

Question

looking at the following client, which of the following method(s) take a parameter in the School class?

public class SchoolClient{

     public static void main (String [ ] args) {

     School school1 = new School ();

     School school2 = new School ("UMass Lowell");

     school1.setname ("Middlesex Community College");

     System.out.println (school1.getname());

     System.out.println (school2.getname());

     }

}

setname

getname

setname and the constructor

setname & getname

A.

setname

B.

getname

C.

setname and the constructor

D.

setname & getname

Explanation / Answer

Hi,

Below is the answer-

The Answer is C. setname and the constructor

setname method is used for the initialization of the member variable of the School class in below statement-

school1.setname ("Middlesex Community College");

constructor is used for the initialization of the member variable of the School class in below statement-

School school2 = new School ("UMass Lowell");

Regards,

Vinay Singh