title: Java using multiple methods in the program
body: <p>I have the following code on Java which works fine now but I'm wondering how to make the same program but with multiple methods (object oriented programming). Right now all the code is in the main method and I'd like to make it so it has at least one other method where the calculations are made and that method would be called in the main method.
  The program asks the user different kinds of multiplication questions like 2*3, 9*5 and so on</p>
  
  <pre><code>import java.util.Random;
  import javax.swing.JOptionPane;
  
  public class Main {
  
    public static void main(String[] args) {
  
      Random number = new Random();
  
      while (true) {
  
          int nmb1 = number.nextInt(10) + 1;
          int nmb2 = number.nextInt(10) + 1;
          int multi = nmb1 * nmb2;
          int question;
  
          // read the user's input ...
          do {
              question = Integer.parseInt(JOptionPane.showInputDialog("How much is" + nmb1 + "*" + nmb2));
  
              if (question != multi) {
                  JOptionPane.showMessageDialog(null, "Wrong, try again");
              }
          }
          while (question != multi);
          // .. and repeat until the user types the correct answer
  
          JOptionPane.showMessageDialog(null, "Right");
        }
     }
  }
  </code></pre>
  
  <p>If anyone can offer any help I would appreciate it.</p>