Consider a simple interaction program in Java. You want to prompt the user to input their name through the console window and then output a greeting message with the user's name included. You may use the Scanner class for the task. Fill the blanks in the code to complete this program correctly and efficiently.
Reading user's input with Scanner
Creating a user name input and greeting message program
Report a typo
Fill in the gaps with the relevant elements
import java.util.;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
("Enter your name: ");
String name = sc.();
System.out.println("Your name is: " + name);
}
} ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.