I have the below code
public class prob01 {
public static void main (String arg[]) {
System.out.println(arg[0]);
}
}
I have a text file prob01.txt in the same directory which contains:
StackOverflow StackExchange
How can I get the output as StackOverflow from the above code when I give the arguments as prob01.txt like below: (I dont want to modify the java code, the dos has to take care of parsing the file and sending the contents as arguments)
C:\> javac prob01.java
C:\> java -cp . prob01 < prob01.txt