008-001-003

Method Basics: Greeting Method

Medium

Problem Description

Method Basics: Greeting Method

Learning Objective: Define a method that takes parameters and returns a value

Create a greeting method. Implement a method that takes a name and returns a greeting.

Input

Line 1: Name (string)

Output

Input name: [name]
Greeting: Hello, [name]!

Test Cases

※ Output examples follow programming industry standards

Input:
Taro
Expected Output:
Input name: Taro
Greeting: Hello, Taro!
Input:
Hanako
Expected Output:
Input name: Hanako
Greeting: Hello, Hanako!
Input:
A
Expected Output:
Input name: A
Greeting: Hello, A!
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 9 free executions remaining