001-001-017
Variable Declaration and Initialization
Easy
Problem Description
variable declaration and Initialization
In this problem, you will create a program that declares and initializes variables of type int, String, and double, then displays each variable's value to standard output.
Learning Objective: Understand the basics of variable declaration and initialization in Java
Overview
In Java, variables must be declared with a type before use. Values can be assigned (initialized) at the time of declaration.
Specifications
- Declare an int variable age and initialize with 25
- Declare a String variable name and initialize with "Alice"
- Declare a double variable height and initialize with 165.5
- Display each variable's value
Output Format
Name: Alice
Age: 25
Height: 165.5
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