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 Person(String name, int yearOfBirth)
myName - name;
myYearofBirth-yearOfBirth;
1
public String getName(
(return myName; )
public void setName(String name)
(m) Name - name:
I
Assume the follwoing declaration has been made.
Aerson student - new Person("Thomas"; 1995);
Which of the follwoing statements is the most appropriate setting a new variable String word to "Thomas"?
String word - new Person("Thomas",1995);
String word - student_getName('Thomas")
String word - studentsetName('Thomas");
String word - student-getName);
String word - studentsetName);

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 Programming Questions!