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

  1. Create a double variable to store your height (in feet).

  2. Create a boolean variable to store whether you like pizza.

  3. 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

  1. Create a double variable to store your height (in feet).

  2. Create a boolean variable to store whether you like pizza.

  3. 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.

Java
public class Main {
public static void main(String[] args) {
//Write your code here:
}
}