002-001-011

Scanner Basics: User Name Input

Easy

Problem Description

Scanner Basics: User Name Input

Learning Objective: Understand how to read strings from standard input using the Scanner class

Overview

Create a program that uses the Scanner class to read a user's name from standard input and output a greeting message using that name.

Specifications

  • Import the Scanner class
  • Read a single line of text from standard input
  • Output "Hello, [name]!" using the read name

Input Format

Alice

Output Format

Hello, Alice!

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?