title: Using arrays in 2 separate classes in java
body: <p>How do i use an array from my main in a different class. I'm making a game where I need to have a single die roll three times. I then take each value and make comparisons like do 2/3 numbers match. if then add to 12 then give the player the pot back.
  This is the class where i want to use the info from the array. I learnt about arrays and loops last night so i dont really know what im doing</p>
  
  <pre><code>    import java.util.Scanner;
  
  public class Game {
  
  private double Bet;
  private double Pot;
  private double TotalPot;
  
  public void Pot( ){
  Pot = 50;
  }
  public void inputBet( ) {
      Scanner keyboard = new Scanner (System.in);
      System.out.println("Please enter the current month in numerical format: ");
      Bet = keyboard.nextDouble();
      if (Bet &lt;= Pot) {
          System.out.println("Error, Bet out of range");
  
          inputBet();
      }
      else if (Bet == 0) {
          System.out.println("Thank you for playing");
      }
  }
  
  public void inputEnd( ){
  
  }
  
  public void removeBet( ){
      TotalPot = Bet - Pot;
  }
  public void dieComparison1(){
  if ((die[0] == die[1]) || (die[0] == die[2])){
      TotalPot = (Bet * 2) + Pot;
      }
  }
  public void print(){
  System.out.println(+ TotalPot);}
  }
  </code></pre>
  
  <p>This is my main where the array is created.</p>
  
  <pre><code>public class Assign3 {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
      //Game smith = new Game();
      //smith.Pot();
      //smith.inputBet();
      int[] die = new int[3];
       Die bob = new Die();
       int total = 0;
       for(int i = 0; i &lt; 3; i++){
          die[i] = bob.rollDie();
          bob.displayDie(die[i]);
          total = total + die[i];
       }
       bob.displayDie(total);
  
  
  }
  }
  </code></pre>