Home > Computers & Tech > Detail
search_icon
Question

2) Create a Java program that outputs three lines, using three println statements. The first line will contain your name, the second line will show where you were born, and third line your hobby (or hobbies). Modify the code to create all the output with a single print statement.

Answer

{"output":"[insert name] \n[insert place of birth] \n[insert hobby]"}

  • Q: What is your name? A: My name is [insert name].
  • Q: Where were you born? A: I was born in [insert place of birth].
  • Q: What is your hobby? (or hobbies) A: My hobby is [insert hobby].
  • Q: How do we output the information using 3 println statements? A: System.out.println("[insert name]"); System.out.println("[insert place of birth]"); System.out.println("[insert hobby]");
  • Q: How do we modify the code to output all the information with a single print statement? A: System.out.println("[insert name] \n[insert place of birth] \n[insert hobby]");