Question: Assume there exists a class called Point that includes a two - parameter constructor. Consider the following code: Point p 1 = new Point (

Assume there exists a class called Point that includes a two-parameter constructor. Consider the following code:
Point p1= new Point(1,4);
Point p2= new Point(3,5);
Point p3= p2;
Point p4= new Point(3,5);
Point p5= p3;
Point p6= p1;
How many Point objects are created in the above code?
Consider the same code from the previous question:
Point p1= new Point(1,4);
Point p2= new Point(3,5);
Point p3= p2;
Point p4= new Point(3,5);
Point p5= p3;
Point p6= p1;
How many references to Point objects are created in the above code?
In a few sentences, explain why the answers to the previous two questions are not the same.

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!