Without knowing the details of your code, I would suggest you to check the size of args
first:
if(args.length> 0) {
//It depends on the size of the argument you wanna check.
//Might be args.length > 1 if you wanna make sure at least 2 elements in the args array
//doSomething
} else {
//doSomethingElse
}
3
solved args[0]==null Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 1 at Main.main(Main.java:69)