Challenge: Personalize Your Java Output
Let’s practice working with text (Strings) in Java.
Write a Java program that creates and prints a formatted message using strings, variables, and special characters.
Your task
Create a
Stringvariable for your name.Create another
Stringvariable for a favorite activity.Print a message that:
combines text and variables using
+includes quotes around the activity
prints the message across two lines
Example output (your text can vary)
Hello, my name is Alex.I love "coding"!
Rules
Use
Stringvariables.Use
+to combine text and variables.Use escape characters like
\"or\n.Write your code inside
main.
Challenge: Personalize Your Java Output
Let’s practice working with text (Strings) in Java.
Write a Java program that creates and prints a formatted message using strings, variables, and special characters.
Your task
Create a
Stringvariable for your name.Create another
Stringvariable for a favorite activity.Print a message that:
combines text and variables using
+includes quotes around the activity
prints the message across two lines
Example output (your text can vary)
Hello, my name is Alex.I love "coding"!
Rules
Use
Stringvariables.Use
+to combine text and variables.Use escape characters like
\"or\n.Write your code inside
main.