title: Get value from HashCode Java
body: <p>I am trying to create a function which makes a random asteroid with (x, y, velocity x, velocity y) values of type BasicAsteroid, this is the constructor and function which creates a random asteroid:</p>
  
  <pre><code>private double x, y;
  private double vx, vy;
  
  public BasicAsteroid(double x, double y, double vx, double vy) {
      this.x = x;
      this.x = y;
      this.vx = vx;
      this.vy = vy;
  }
  
  public static BasicAsteroid makeRandomAsteroid() {
      Random rand = new Random();
      BasicAsteroid x = new BasicAsteroid((rand.nextInt()%FRAME_WIDTH), (rand.nextInt()%FRAME_HEIGHT), (rand.nextInt()%MAX_SPEED), (rand.nextInt()%MAX_SPEED));
      System.out.println(x);
      return x;
  }
  </code></pre>
  
  <p>However this is the output when I create the asteroid:</p>
  
  <p>game1.BasicAsteroid@6773120a</p>
  
  <p>game1.BasicAsteroid@4261b6b3</p>
  
  <p>game1.BasicAsteroid@2673b915</p>
  
  <p>game1.BasicAsteroid@113eb90b</p>
  
  <p>game1.BasicAsteroid@1abcc522</p>
  
  <p>How can I output the values instead of the class@hashcode?</p>
  
  <p>Thanks.</p>