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?
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 55Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started