Invoking a greeting method within another method

Report a typo

You are working on a Java application for greeting users. You have a method named 'greetUser' which takes a String input 'name' and it returns a greeting message. Now you need to call this method in another method. Fill the blanks in code to invoke this method properly and print the greeting message for a user.

Fill in the gaps with the relevant elements
 class Main {
    public   (String[] args) {
        String greeting = greetUser("John Doe");
        System.out.println(greeting);
    }

    public static String greetUser(String name) {
        return "Hello, " + name + "!";
    }
}
staticmainpublicvoid
___

Create a free account to access the full topic