There's a thing which I'm not quite sure about and really want to make it clear.
When we write
public static void main(String[] args), does that mean we allowed to put a vector of parameters when we run the program?
Like in this case when running the program we should enter: java Lowercase text1.txt text2.txt
Basically, if anyone can explain to be the "args" parts, I would be very grateful for that.
Thanks
import java.io.*;
public class Lowercase {
public static void main(String [] args) {
try {
FileInputStream fileIn = new FileInputStream(args[0]);
FileOutputStream fileOut = new FileOutputStream(args[1]);
int i;
while ((i = fileIn.read()) != -1) {
fileOut.write(Character.toLowerCase((char)i));
}
} catch (IOException e) {
System.err.println(e);
}
}
}


Sign In
Create Account


Back to top









