Skip to content

Commit a5d0838

Browse files
committed
feat: Print formatted movie quote using escape sequences [escape-quote-format]
🔑 Key: escape-quote-format 🧠 Logic: - Demonstrates multiple escape characters in one line: • `\'` – inserts a single quote: `Here's` • `\"` – inserts a double quote: `Johnny!"` • `\n` – moves the following line to a new line. • `\t` – adds horizontal tab before the source/attribution. 🧾 Output: Here's Johnny!" - The Shining 📘 Purpose: - Combines single quote, double quote, newline, and tab for proper quote formatting. - Demonstrates advanced use of string escape sequences in Java for textual formatting and printing. Signed-off-by: Somesh diwan <[email protected]>
1 parent bdd6b71 commit a5d0838

File tree

1 file changed

+10
-0
lines changed
  • JDK Features/Escape Sequences in Java/src

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Code5 {
2+
public static void main(String[] args) {
3+
// Prints the famous movie quote using escape sequences
4+
// \' is used to include a single quote within the string
5+
// \" is used to include a double quote within the string
6+
// \n is used to add a new line
7+
// \t is used to add a tab space before "- The Shining"
8+
System.out.println("Here\'s Johnny!\"\n\t- The Shining");
9+
}
10+
}

0 commit comments

Comments
 (0)