title: Call Method from Main Java
body: <p>I'm trying to call a method, WriteToFile, from The main method. Here is what I have so far:</p>
  
  <pre><code>public void main(String [ ] args)
  {
      String fileLoc = Environment.getExternalStorageDirectory() + File.separator + "AccelData.txt";
  
      File AccelData = new File(fileLoc);
  
      AccelData.WriteToFile(fileLoc, AccelData);
  }
  </code></pre>
  
  <p>And the WriteToFile method is:</p>
  
  <pre><code>public void WriteToFile(String fileLoc, File AccelData){
      //code in here
  }
  </code></pre>
  
  <p>I get a red line under the <code>AccelData.WriteToFile</code>line, which just says I should add a cast, which doesn't fix it.</p>
  
  <p>Thanks for your help.</p>