title: Passing random numbers into an instance of an object
body: <p>my homework is asking me to do a math game in which I prompt the user to answer math questions and then show them the answer. I've created the <code>MathGame</code>class, but when I create an instance of <code>MathGame</code>, it asks me to put in two ints, which I don't know because I'm trying to generate them randomly. </p>
  
  <p><strong>Question</strong>: How do I get my random numbers from the class to pass into the instance of <code>MathGame</code>?</p>
  
  <p>Below is the <code>MathGame</code> class</p>
  
  <p>Underneath that is the main with the instance of <code>MathGame</code> I'm trying to figure out. </p>
  
  <pre><code>import java.util.Random;
  
  public class MathGame {
  
      private int operand1;
      private int operand2;
      private int solution;
  
      public MathGame(int operand1, int operand2) {
          this.operand1 = operand1;
          this.operand2 = operand2;
      }
  
      public int genRandom1() {
          Random rand = new Random();
          int randNum = rand.nextInt(0) + 20;
          randNum = operand1;
          return operand1;
      }
  
      public int genRandom2() {
          Random rand = new Random();
          int randNum2 = rand.nextInt(0) + 20;
          randNum2 = operand2;
          return operand2;
      }
  
      public int getoperand1() {
          return operand1;
      }
  
      public int getoperand2() {
          return operand2;
      }
  
      public String question() {
          return "What is" + operand1 + operand2 + "?";
      }
  
      public String solution() {
          int solution = operand1 + operand2;
          return "The correct answer is: " + solution;
      }
  
  }
  </code></pre>
  
  <p>I get an error in the instance of MathGame since I need to have two ints go through, but I don't know the ints obviously because they're supposed to be randomly generated, which I did in the class.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class MathGameMain {
  
      public static void main(String[] args) {
          Scanner scan = new Scanner(System.in);
          MathGame game1 = new MathGame();
      }
  
  }
  </code></pre>