Read
โ Step-by-Step: Prompt for Name in Java
๐น Step 1: Import Scanner
This allows you to use the Scanner
class for reading user input.
๐น Step 2: Create Scanner Object
This connects the scanner to the keyboard input.
๐น Step 3: Prompt the User
Displays a message asking the user for their name.
๐น Step 4: Read the Name
Stores the input into a String
variable called name
.
๐น Step 5: Display the Name
Prints a greeting using the entered name.