Question: public class Person { private int age; private String name; public Person(int age, String name) { this.age = age; this.name = name; } public void

 public class Person { private int age; private String name; public

public class Person { private int age; private String name; public Person(int age, String name) { this.age = age; this.name = name; } public void haveBirthday() { age++; } } public static void main(String[] args) { Person p1 = new Person(30, "Shaun"); Person p2 = new Person (27, "Amanda"); Person p3 = p2; aMethod(p1, p2); } public static void aMethod (Person a, Person b) { b.haveBirthday(); a = new Person(46, "Alice"); } Consider the Person class as developed in the pre-recorded lecture videos (a simplified version is included above for reference). What is the value of each Person's age instance variable right after the code above executes? p1's age: A p2's age: A p3's age

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!