title: how can i create a 4x9 matrix to store 36 randomly generated values and display it to the matrix?
body: <p><a href="https://i.stack.imgur.com/YuaPn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YuaPn.jpg" alt="enter image description here"></a></p>
  
  <p>i tried doing it but still have problems with the code. Cant really figure out how to do it so i would appreciate any help. It keeps showing error messages that i really don't understand and i just can't do anything else.
  This is what i've done:</p>
  
  <pre><code>import javax.swing.*;
  
  int [] player = new int [] {"Player 1", "Player 2", "Player 3", "Player 4"};
  int [] hole = new int [9];
  String [][] golf = new String [][] {player[], hole[]};
  
  void setup()
  {
    JOptionPane.showMessageDialog(null, "Welcome to Golf Simulator" + '\n');
    int input = 0;
    do {
      String in = JOptionPane.showInputDialog("1. See the final results table"        + '\n' + 
        "2. Enter the golf scores for Player 1 " + '\n' + "3. Enter the golf scores for Player 2" + 
    '\n' + "4. Enter the golf scores for Player 3" + '\n' + "5. Enter the golf scores for Player 4" +
    '\n' + "6. Results for holes" + '\n' + "7. Exit program", null);
  input = Integer.parseInt(in);  
  
  char c = in.charAt(0);
  
  switch(c) {
  case '1': 
    showWin();
    break;
  
  case '2':
    for (int i = 0; i &lt; golf[0].length; i++) {
      String inn = JOptionPane.showInputDialog("Please enter the golf scores for Player 1", null);
      int n = Integer.parseInt(inn);
      golf[0][i] = n;
    }
    break;
  
  case '3':
    for (int i = 0; i &lt; golf[0].length; i++) {
      String inn = JOptionPane.showInputDialog("Please enter the golf scores for Player 2", null);
      int n = Integer.parseInt(inn);
      golf[1][i] = n; 
    }
    break;
  
  case '4':
    for (int i = 0; i &lt; golf[0].length; i++) {
      String inn = JOptionPane.showInputDialog("Please enter the golf scores for Player 3", null);
      int n = Integer.parseInt(inn);
      golf[2][i] = n; 
    }
    break;
  
  case '5':
    for (int i = 0; i &lt; golf[0].length; i++) {
      String inn = JOptionPane.showInputDialog("Please enter the golf scores for Player 4", null);
      int n = Integer.parseInt(inn);
    }
    break;
  
  case '6':
   showWin(hole); {
      int score = 0;
      ArrayList&lt;Integer&gt; tied = new ArrayList&lt;&gt;();
      for (int i = 0; i &lt; golf.length; i++) {
        if (golf[i][hole] &gt; score) { // new winnger
          score = golf[i][hole]; // adjust high score
          tied.clear(); // throw out every tied player
          tied.add(winner); // add the winner
        } else if (golf[i][hole] == score) { // we have a new tied player
          tied.add(i); // add him
        }
      }
      if (tied.size() &lt;= 1) {
        str += "Winner: " + winner + " with score: " + score;
      } else {
        str += "Tied: ";
        for (int i : tied) { // add all tied players to the output
          str += i + " ";
        }
        str += "with score: " + score;
          }
        }
      }
    } while (input != 6);
  }
  
  void showWin()
  {
    String str = "";
    for (int i = 0; i &lt; win.length; i++)
    {
      str = str + win[i] + '\n';
    }
    JOptionPane.showMessageDialog(null, str);
  }
  </code></pre>
  
  <p>The error messages i got said: unexpected token:> where it says <code>ArrayList&lt;Integer&gt; tied = new ArrayList&lt;&gt;();</code></p>