001-004-008
Numeric Type Conversion
Easy
Problem Description
Numeric Type Conversion
In this problem, you will create a program that performs implicit conversion from int to double and explicit casting from double to int, and displays the result to standard output.
Learning Objective: Understand implicit type conversion and explicit type conversion (casting) in Java
Overview
Create a program that performs type conversion between different numeric types.
Specifications
- Assign
100tointvariableintValue - Convert
intValuetodoubleand assign todoubleValue(implicit conversion) - Assign
3.14159todoublevariablepi - cast
pitointand assign tointPi(explicit conversion)
Output Format
int to double: 100.0
double to int: 3
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