Skip to content

Commit 43ec037

Browse files
committed
feat: Demonstrate newline character usage with println [newline-demo]
🧠 Logic: - Prints a string using `\n` escape sequence to break into two lines. - `"Hello\nWorld"` results in: Hello World 📘 Purpose: - Demonstrates how newline `\n` works inside `System.out.println()`. - Useful for learning escape characters in Java string formatting. ✅ Output formatting: - This is especially relevant for CLI/terminal output, text layout, and competitive programming. Signed-off-by: Somesh diwan <[email protected]>
1 parent 9c3dcbf commit 43ec037

File tree

1 file changed

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

1 file changed

+6
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public class Code1 {
2+
public static void main(String[] args) {
3+
// Newline
4+
System.out.println("Hello\nWorld");
5+
}
6+
}

0 commit comments

Comments
 (0)