1

So I'm working on creating the game of Monopoly, I'm in way over my head but I'm willing to learn. Anyways my problem is that I create the array with size based on user input (holds the different Player objects) but when I try accessing the index of the array (those objects) from another class or even a different object, I get the error "cannot find symbol - variable arr(the array at hand)" How can I gain access to the data in these Players? If my question is unclear just ask and I'll restate it. (error is in last line of PlayerOrder)

Player[] arr; was outside of the scope of other objects, meaning it was specific to the object I declared in so I couldn't access it's info using another method.

To fix this, I added..

private Player[] arr;

as seen here..

private Player[] arr;
import java.util.Scanner;
import java.util.Random;
public class Launcher
{
PairOfDice myDice = new PairOfDice();
private Planet myTest;
private PlanetInfo myPlanetInfo;
private int p1;
private int p2;
//more code

0 Answers0