title: How can I pick just one value from random integer variable in java?
body: <p>I would like a little help in java from you guys. My idea is to generate two integer variables from the random method and make it a constant string. Something like:</p>
  
  <pre><code>//In Class
  Random rand = new Random();
  protected int aux1 = rand.nextInt(9999), aux2 = rand.nextInt(10);
  public final String x = aux1+"-"+aux2;  //is it possible to take just one time?
  
  public String getX() {return x;}
  </code></pre>
  
  <p>But each time when I use the getX() in main class I got different values for x:  9626-3 4938-0 6500-6 </p>
  
  <p>instead of:  4938-0 4938-0 4938-0 </p>
  
  <p>How can I do this?</p>
  
  <p>grateful for the attention.</p>