Q:

Under my constructor for an array, I have a toString method that prints out the contents. But it's telling me it isn't resolved to a variable

So my constructor creates an array, and I want my toString method to display the contents. However, I'm getting an error telling me that table[i] can not be resolved to a variable, even though it was created in the constructor. Please help!
public int size = 38;
public int first = 0;
public int last = 2;
public int count = 1;

public Table()
{
    int[] table = new int[size]; 
    table[0] = first;
    table [size-1] = last;
    for(int i = 1; i < size-1; i++){
        if(count == first | count == last)
            count++;
        table[i] = count;
        count++;
        }
}

public String toString(){
    String string = "Wheel: 0";
    for(int i = 1; i < size; i++)
        string = string + "-" + table[i] ; //table[i] CAN NOT BE RESOLVED TO A VARIABLE
    return string;

}

A:

Your table is defined locally in your constructor.
int[] table = new int[size]; 

You have to declare it outside the constructor:
int[] table;
public Table()
{
    table = new int[size]; 
...

