X842: Using Paramters 2

For this problem assume you have access to a Person class defined here:

x
 
1
2
public class Person{
3
  public String name;
4
  private int age;
5
6
  public void setAge(int a){
7
    age = a;
8
  }
9
10
  public void setName(String n){
11
    name = n;
12
  }
13
}

Below you've been given a method and a Person object has been created. Using the methods defined above, set age to 35 and name to "Carl".

Your Answer:

xxxxxxxxxx
4
 
1
public void setAgeAndName(Person p) {
2
   
3
}
4

Feedback

Your feedback will appear here when you check your answer.