010-003-003
Overloading: Distinguish by Argument Type
Easy
Problem Description
Overloading: Distinguish by Argument Type
Learning Objective: Understand overloaded methods with different argument types
Define two printValue methods with the same name but different argument types (int and double). Java automatically selects which method to call based on argument type.
Input
Line 1: Integer value
Line 2: Decimal value
Output
Integer: [integer value]
Double: [decimal value]
Test Cases
※ Output examples follow programming industry standards
Input:
42 3.14
Expected Output:
Integer: 42 Double: 3.14
Input:
100 99.99
Expected Output:
Integer: 100 Double: 99.99
Input:
0 0.0
Expected Output:
Integer: 0 Double: 0.0
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
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
