I am trying to write a big system that inputs data from a text file, and has a parser file. So, do I have to write a main file that would call the parser, and if so, how would I call the parse开发者_运维技巧r file, just code it like this?
Parser parser = new Parser();
If not, what would be my options???? Thank you for your help :) FOR the parser how would I specify the text file to be read on the command line. I have a
public static void main (String[] commandLineArgs)
how would I write a specific text file in this statement???? Would i replace the commandLineArgs? I forgot about this.
YourClass YourFile; // Need to fully qualified class name and full path for the file.
EDIT : If I understand correctly, you need something like this :
public class Parser {
public void parseFile (String file) {
// parsing code goes here.
}
public static void main (String[] commandLineArgs) {
Parser parser = new Parser();
parser.parseFile(commandLineArgs[0]); //
}
}
精彩评论