Greetings and arguments, oh my!

Report a typo
Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
Create a Java program that prints "Hello, Java!" and displays the number and content of command-line arguments. Fill in the blanks to complete the main method declaration and make the program functional.
Fill in the gaps with the relevant elements
 class MainMethodExample {
    public   ([] args) {
        System.out.println("Hello, Java!");
        System.out.println("Number of arguments: " + args.length);
        for (int i = 0; i < args.length; i++) {
            System.out.println("Argument " + i + ": " + args[i]);
        }
    }
}

Create a free account to access the full topic