I just figured that, we can redirect both System.out
and System.err
messages to a file, am not able to understand this command which does redirecting while running this below file using : java StandarProgram> output.log 2>error.log
What is 2? and if am not using 2, error messages are displayed on console and not redirected to file? am not able to get this at all.
public class StandardProgram{
public static void main(String[] args){
System.out.println("Hello");
System.err.println("World");
}
}