title: I want to decide the array sizing in a method, however my array needs to be public... How would I do this?
body: <p>Currently, the array sizes are only 0. How would I change it so that my arrays stay public, but the sizing of the array can be changed in a method? The array needs to be public as it has to be accessed in other methods.</p>
  
  <pre><code>public class Array {
  
  public int sizeArray;
  
  public String mainArray [] = new String [sizeArray];
  
   public String halfArray[] = new String [sizeArray/2];
  
  public void arraySizeManipulate () {
  
  String line = ""; 
  
  int x = -1;
  
  try {
    BufferedReader r = new BufferedReader (new FileReader("File.txt"));
    while (line != null)
    {
      line = r.readLine ();
      x++;
    }
    r.close ();
  }
  catch (IOException e)
  {
    System.out.println (e);
  }
  sizeArray = x;
  }
  }
  </code></pre>