Solution: Store Personal Info in Java

  • public class Main – defines the class Main.

  • public static void main(String[] args) – main method where the program starts.

  • double height = 5.9; – stores a decimal number (5.9) in a variable named height.

  • boolean likesPizza = true; – stores a true/false value in likesPizza.

  • System.out.println("Height: " + height + " ft. Likes pizza? " + likesPizza); – combines text and variables, then prints:

    • Height: 5.9 ft. Likes pizza? true

Solution: Store Personal Info in Java

  • public class Main – defines the class Main.

  • public static void main(String[] args) – main method where the program starts.

  • double height = 5.9; – stores a decimal number (5.9) in a variable named height.

  • boolean likesPizza = true; – stores a true/false value in likesPizza.

  • System.out.println("Height: " + height + " ft. Likes pizza? " + likesPizza); – combines text and variables, then prints:

    • Height: 5.9 ft. Likes pizza? true