Skip to content

Instantly share code, notes, and snippets.

@Chris--B
Created November 9, 2012 23:16
Show Gist options
  • Save Chris--B/4048949 to your computer and use it in GitHub Desktop.
Save Chris--B/4048949 to your computer and use it in GitHub Desktop.
public int readFile(String filename)
{
try
{
Scanner scan = new Scanner(new File(filename));
int i = 0
while(scan.hasNext())
{
strings[i] = scan.nextLine();
++i;
}
return i + 1;
}
catch (FileNotFoundException e)
{
System.out.println("File not found");
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment