Challenge: Store Personal Info in Java
Let’s practice using variables in Java to store different types of information.
Write a Java program that:
stores a decimal number
stores a true/false value
prints them together in one sentence
Your task
Create a
doublevariable to store your height (in feet).Create a
booleanvariable to store whether you like pizza.Use
System.out.println()to print a sentence that includes both variables.
Example output (yours can vary)
Height: 5.9 ft. Likes pizza? true
Reminder: Java code runs inside the main method.
Challenge: Store Personal Info in Java
Let’s practice using variables in Java to store different types of information.
Write a Java program that:
stores a decimal number
stores a true/false value
prints them together in one sentence
Your task
Create a
doublevariable to store your height (in feet).Create a
booleanvariable to store whether you like pizza.Use
System.out.println()to print a sentence that includes both variables.
Example output (yours can vary)
Height: 5.9 ft. Likes pizza? true
Reminder: Java code runs inside the main method.