Question: Consider the following class declaration public class Person private String my Name; private int myYearOfBirth; public Person ( String name, int yearOfBirth ) myName -
Consider the following class declaration
public class Person
private String my Name;
private int myYearOfBirth;
public PersonString name, int yearOfBirth
myName name;
myYearofBirthyearOfBirth;
public String getName
return myName;
public void setNameString name
m Name name:
I
Assume the follwoing declaration has been made.
Aerson student new PersonThomas; ;
Which of the follwoing statements is the most appropriate setting a new variable String word to "Thomas"?
String word new PersonThomas;
String word studentgetNameThomas
String word studentsetNameThomas;
String word studentgetName;
String word studentsetName;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
