Skip to content

Commit 5c08416

Browse files
committed
feat: Display shopping list using escape sequences for formatting [string-escape-print]
🔑 Key: string-escape-print 🧠 Logic: - Uses `\n` for newline to list items line by line. - Uses `\t` (via spacing) and `-` for bullet points. - Escapes double quotes (`\"`) for the word "Organic". - Escapes backslash (`\\`) to print a literal backslash between "Apples \ Pears". 🎯 Focused on understanding how special characters and escape sequences improve text formatting in console outputs. 🧪 Sample Output: My shopping List: - Bread - "Organic" Milk - Apples \ Pears Signed-off-by: Somesh diwan <[email protected]>
1 parent cdbe1cc commit 5c08416

File tree

1 file changed

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

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Code7 {
2+
public static void main(String[] args) {
3+
System.out.println("My shopping List:\n" +
4+
" - Bread\n" +
5+
" - \"Organic\" Milk\n" +
6+
" - Apples \\ Pears");
7+
}
8+
}

0 commit comments

Comments
 (0)