Q:

CSV error when loading file into 2D array

I have a CSV file and my assignment involves taking that file and loading it into a 2D array. I've counted how many rows there and how man columns there are but, when I go to load it into the array I get the error

"non-static variable filetable cannot be referenced from a static
  context"

But when if I do this public static String[][] filetable = new String[rows][cols];
I get the error

Illegal reference forward Usage of static non-final variable during
  intialization

Code:
public String[][] filetable = new String[rows][cols];//The second error doesn't show up here since I haven't put 'static' after public.
public static int rows = 0;
public static int cols = 0;

 public static void to_Array(File example)
{        

 try 
    {
         FileReader file = new FileReader(example);
         Scanner sc = new Scanner(file);  

         if(sc.hasNextLine())
         { 
             String[] tokens = sc.nextLine().split(",");
             cols = tokens.length;
             rows++;
         }

         while(sc.hasNextLine())
         {
             rows++;
             sc.nextLine();                 
         }

         //Probably not the right way to load the file into the array, but will fix it later
         for(int r = 0; r < rows; r++)
         {
             for(int c = 0; c < cols; c++)
             {
                 filetable[r][c] = sc.next();// This where the first error shows up
             }
         }

    } 
    catch (FileNotFoundException e) 
    {
        System.out.println(e);
    }

A:

public static void  method 

if the method is static you can reference to the local variable only if they are also static 
public SomeClass {
  private static String var1;
  private String var2;

  public void someMethod(){
     this.var2 // is allowed 
     this.var1 // is allowed
   }

   public static void someMethod(){
     this.var2 // is allowed 
     this.var1 // is not allowed
   }

}

i suggest that you create a method in the class than in the main() method create a new instance of the class than call the method 
 SomeClass test = new SomeClass():
  test.someMethod()// copy the code of the main to this method

