Question: What happens on the object jamie and the object jane after executing the following jamie.give Last NameTo2(jane)? public class Name { private String first;

What happens on the object jamie and the object jane after executing 

What happens on the object jamie and the object jane after executing the following jamie.give Last NameTo2(jane)? public class Name { private String first; private char initial; private String last; Name jamie = new Name(); jamie.setFirst("Jamie"); jamie.setLast ("Jones"); Name jane = new Name(); jane.setFirst("Jane"); jane.setLast("Doe"); jamie.giveLastName To2 (jane); public void give Last Name To2 (Name child) { String firstName = child.getFirst(); child = new Name(); child.setFirst(firstName); child.setLast (last); } //end giveLastNameTo2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code provided has some syntax errors and inconsistencies so Ill correct them and explain what ha... View full answer

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!