Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I will need you to hand tracing this code and this code is java language. Thank you. I/ Changing People.java // Demonstrates parameter passing --

I will need you to hand tracing this code and this code is java language. Thank you.

image text in transcribed

I/ Changing People.java // Demonstrates parameter passing -- contains a method that should change two Person objects. // ***** public class Changing People { II // Sets up two person objects, one integer, and one String Il object. These are sent to a method that should make Il some changes. Il public static void main(String[] args) Person person1 = new Person ("Sally", 13); Person person2 = new Person ("Sam", 15); int age = 21; String name = "Jill"; System.out.println(" Parameter Passing... Original values..."); System.out.println ("person 1: " + person 1); System.out.println ("person2:" + person2); System.out.println ("age:" + age + "tname:" + name + " "); change People (person1, person2, age, name); System.out.println (" Values after calling changePeople..."); System.out.println("person1: " + person); System.out.println ("person2: " + person2); System.out.println ("age:" + age + "tname:" + name + " "); ) // Il Change the first actual parameter to "Jack - Age 101" and change // the second actual parameter to be a person with the age and // name given in the third and fourth parameters. // public static void change People (Person P1, Person p2, int age, String name) { System.out.println(" Inside changePeople... Original parameters..."); System.out.println ("person1: " + p1); System.out.println ("person2:" + p2); System.out.println ("age:" + age + "\tname:" + name + " "); // Make changes Person P3 = new Person (name, age); p2 = p3: name = "Jack"; age = 101: p1.changeName (name); p1.changeAge (age); // Print changes System.out.println(" Inside changePeople... Changed values..."); System.out.println ("person1:" + p1); System.out.println("person2:" + p2); System.out.println ("age:" + age + "tname:" + name + " "); } I/ Changing People.java // Demonstrates parameter passing -- contains a method that should change two Person objects. // ***** public class Changing People { II // Sets up two person objects, one integer, and one String Il object. These are sent to a method that should make Il some changes. Il public static void main(String[] args) Person person1 = new Person ("Sally", 13); Person person2 = new Person ("Sam", 15); int age = 21; String name = "Jill"; System.out.println(" Parameter Passing... Original values..."); System.out.println ("person 1: " + person 1); System.out.println ("person2:" + person2); System.out.println ("age:" + age + "tname:" + name + " "); change People (person1, person2, age, name); System.out.println (" Values after calling changePeople..."); System.out.println("person1: " + person); System.out.println ("person2: " + person2); System.out.println ("age:" + age + "tname:" + name + " "); ) // Il Change the first actual parameter to "Jack - Age 101" and change // the second actual parameter to be a person with the age and // name given in the third and fourth parameters. // public static void change People (Person P1, Person p2, int age, String name) { System.out.println(" Inside changePeople... Original parameters..."); System.out.println ("person1: " + p1); System.out.println ("person2:" + p2); System.out.println ("age:" + age + "\tname:" + name + " "); // Make changes Person P3 = new Person (name, age); p2 = p3: name = "Jack"; age = 101: p1.changeName (name); p1.changeAge (age); // Print changes System.out.println(" Inside changePeople... Changed values..."); System.out.println ("person1:" + p1); System.out.println("person2:" + p2); System.out.println ("age:" + age + "tname:" + name + " "); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

2. Discuss the steps in preparing a manager to go overseas.

Answered: 1 week ago