013-002-011
String to Number with Integer.parseInt()
Easy
Problem Description
String to Number with Integer.parseInt()
In this problem: You will create a program that converts strings to integers using the Integer.parseInt() method and outputs calculation results.
Learning Objective: Understand string-to-number conversion using the Integer wrapper class parse method
Overview
In Java, the string "123" and the number 123 are different types. To use a string as a number in calculations, you need to convert it with Integer.parseInt(). Passing an unconvertible string will cause an exception.
Specifications
- Convert 3 numeric strings ("100", "250", "50") to int
- Calculate and print the sum
- Calculate and print the average (integer division)
- Print Integer.MAX_VALUE and Integer.MIN_VALUE
Output Format
Values: 100, 250, 50
Sum: 400
Average: 133
Max int: 2147483647
Min int: -2147483648
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