Is there any possible way to run a java file with no argument and 1(as an argument) at the same time?The program will print no arguments and 1 arguments when called with zero and one arguments.

Moderator: admin
Is there any possible way to run a java file with no argument and 1(as an argument) at the same time?The program will print no arguments and 1 arguments when called with zero and one arguments.
Code: Select all
class SomeClass{
public static void main( String args[ ] ){
if (args.length == 0 ){
System.out.println("no arguments") ;
}
else{
System.out.println( args.length + " arguments") ;
}
}
}
Users browsing this forum: Bing [Bot] and 4 guests