008-003-008

Method Parameters: Named Greeting

Medium

Problem Description

Method Parameters: Named Greeting

Learning Objective: Understand how to pass arguments to methods for processing

Overview

Create a method that receives a name as an argument and displays a greeting including that name.

Specifications

  • Define greet method in Greeter class
  • Receive String parameter name
  • Output in format "Hello, name!"
  • Call twice in main method with "Alice" and "Bob"

Output Format

Hello, Alice!
Hello, Bob!

Ready to Try Running Code?

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

Don't have an account?