How can I get this program to read in the "lab13.txt" in the command line? I've been trying to figure this out for over an hour and nothing seemed to work.
The prompt is "Write a program that determines and displays the number of lines in the file whose name you specify on the command line. Test your program with lab13.txt."
import java.util.Scanner;
import java.io.*;
class homework
{
public static void main(String[] args) throws IOException
{
Scanner inFile= new Scanner(new File("lab13.txt"));
int count=0;
String s;
while (inFile.hasNextLine())
{
s = inFile.nextLine();
count++;
}
System.out.println(count + " Lines in lab13.txt");
inFile.close();
}
}