Wednesday, 15 July 2015

How to get two files from the terminal to be used by a class (as in java.io.File) -


So I'm taking two files (most likely) and passing them through a terminal in a class , Which will be used later in the input and scan with a buffered reader. Although I am having difficulty finding out how to do this through the terminal and not only call indiscriminate file names in the code.

The end result of the call should look like this

  java & lt; Class & gt; FileA.txt fileB.txt  

or

  Java & lt; Class & gt; Desktop / FileAntest Document / File B.txt  

Can use:

  public static zero main (string algos []) {if (args.length & lt; 2) throw new exception runtime ("2 arges should be!"); File file 1 = new file (args [0]); File file 2 = new file (args [1]); }  

No comments:

Post a Comment