Search code examples
javacommand-linearguments

Java Command line arguments


I am trying to detect whether the 'a' was entered as the first string argument.


Solution

  • public class YourClass {
        public static void main(String[] args) {
            if (args.length > 0 && args[0].equals("a")){
                //...
            }
        }
    }