010-003-005

Overloading by Type: Data Display

Medium

Problem Description

Overloading by Type: Data Display

Learning Objective: Understand overloading with different argument types

Overview

Methods with the same name can be defined separately if argument types differ. Create methods with different processing for int and String types.

Specifications

  • display(int) shows "Number: value"
  • display(String) shows "Text: string"
  • Call both methods

Output Format

Number: 42
Text: Hello

Test Cases

※ Output examples follow programming industry standards

Input:
Expected Output:
Number: 42
Text: Hello
❌ 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