I have this code here:
try {
System.out.print("There are args!: " + args[0]);
} catch (Exception e) {
System.out.print("No args");
}
I am checking if arguments were passed when I executed the program. If no arguments are passed, and I try to print the first index of arguments, an Exception is thrown. I can use a Try-Catch block to catch the Exception, and declare there is no arguments.
How could I do this with an 'If Statement'?
I tried:
if (args[0] == null)
//And
if (args[0] == '')
And still got an Exception. What is "args[0]" equal to if no arguments are passed?
....................