013-002-008

Basic Numeric Wrapper Classes

Easy

Problem Description

Basic Numeric Wrapper Classes

In this problem, you will create a program that reads an integer value and a numeric string from standard input, converts the int value to a wrapper class using Integer.valueOf(), converts it back to a primitive with Integer.intValue(), and parses the string to a number using Integer.parseInt(), then displays the results to standard output.

Learning Objective: Understand how to use numeric wrapper classes like Integer and Double

Overview

Implement mutual conversion between primitive types and wrapper classes.

Input Format

integer value
numeric string

Specifications

  • Convert the first line's integer to wrapper with Integer.valueOf()
  • Convert back to primitive with Integer.intValue()
  • Convert the second line's string to number with Integer.parseInt()

Output Format

Primitive: [integer value]
Wrapper: [integer value]
Parsed: [parsed number]

Example

Input:

42
100

Output:

Primitive: 42
Wrapper: 42
Parsed: 100

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