010-003-009

Overloading by Argument Type

Easy

Problem Description

Overloading by Argument Type

In this problem, you will create a program that defines two methods named display with different argument types (display(int value) and display(String value)), reads an integer and a string from standard input, calls both methods, and displays the results to standard output.

Learning Objective: Understand method overloading with different argument types

Overview

Define methods with the same name but different argument types.

Input Format

integer value
string value

Specifications

  • Read an integer on the first line and a string on the second line
  • display(int value) method: displays integer
  • display(String value) method: displays string
  • Call both methods

Output Format

Integer: integer value
String: string value

Ready to Try Running Code?

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

Don't have an account?

Sign Up