Question: Draw a memory model for the following code: public class Point { private double x; private double y; public Point(double x_in, double y_in) { this.x

Draw a memory model for the following code:

public class Point

{

private double x;

private double y;

public Point(double x_in, double y_in)

{

this.x = x_in;

this.y = y_in;

this.y = 55;

}

public static void main( String[] args )

{

double d = 42.0;

Point p;

p = new Point(d, 42.0);

Point q = new Point(p.x, 42) p = q; p.x = q.y;

}

}

------------------------------------------------------------------

1. What does the variable p contain?

A. A value 42.0

B. A reference to a point object, which has an x value of 42, and a y value of 55.

C. A reference to a point object, which has an x value of 55, and a y value of 42;

D. A reference to q

E. None of these

--------------------------------------------------------------

2. Which memory model best reflects this code?

Draw a memory model for the following code: public class Point {

please help me! Thanks in advance! (java programming)

d 42.0 d 42.0 x 42 y 55.0 x 42. y 55 x 55 E. Other C. d 42.0 D. d 42.0 55 y 55

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!