public class Vector2 { private float x, y; public Vector2(){ x = 0; y = 0; } public Vector2(float x, float y){ this.x = x; this.y = y; } public void setX(float x){ this.x = x; } public float getX(){ return x; } public void setY(float y){ this.y = y; } public float getY(){ return y; } public void add(Vector2 other){ x += other.getX(); y += other.getY(); } }