Question: Consider the following Point2D class. public class Point2D { private double xCoord; private double yCoord; public Point2D(double x, double y) { xCoord = x; }
Consider the following Point2D class. public class Point2D
{ private double xCoord; private double yCoord; public Point2D(double x, double y)
{ xCoord = x; } yCoord = y; } Which of the following code segments, appearing in a class other than Point2D, will correctly create an instance of a Point2D object?
A Point2D p = (3.0, 4.0);
B Point2D p = Point2D(3.0, 4.0);
C new p = Point2D(3.0, 4.0);
D new Point2D = p(3.0, 4.0);
E Point2D p = new Point2D(3.0, 4.0);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
