Question: public final class Vector2 extends java.lang.Object public final class Vector2 { private double x; private double y; private String name; Q1 public double getx() Returns
-
public final class Vector2 extends java.lang.Object
- public final class Vector2 { private double x; private double y; private String name;
- Q1
-


public double getx() Returns the x component of the vector. Returns: the x component of the vector. public void setx (double x) Sets the x component of the vector. Parameters: x - the new value of the x component. public Vector2 add (Vector2 other) Add a vector to this vector changing the components of this vector. Mathematically, if this vector is a and the other vector is b then invoking this method is equivalent to computing a + b and assigning the value back to a. Parameters: other - the vector to add to this vector. Returns: this Vector2D object
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
