013-002-009
Autoboxing and Unboxing
Medium
Problem Description
Autoboxing and Unboxing
In this problem, you will create a program that reads two integer values from standard input, converts them via autoboxing to Integer, converts back via unboxing to int, and displays the results to standard output.
Learning Objective: Understand the mechanism of automatic conversion (autoboxing/unboxing)
Overview
Use Java's automatic type conversion to handle primitives and wrappers transparently.
Input Format
a
b
- Line 1: integer a (subject of autoboxing)
- Line 2: integer b (subject of unboxing)
Specifications
- Autoboxing: automatic conversion int a → Integer
- Unboxing: automatic conversion Integer → int b
- Verify automatic conversion during calculation (receive a + b as int)
Output Format
Autoboxed: a
Unboxed: b
Calculation result: a+b
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