How to escape a character in java
Character Escape Codes.
The following codes are used to represents codes or characters which cannot be directly accessible
through a keyboard:
Code Description
\n is use go to a new line N mean Line
\t is use to make a paragraph Tab
\b Backspace
\r Carriage Return
\\ Backslash
\’ Single Quotation Mark
\” Double Quotation Mark
It ise to add quote to a code or conmcom.
\* Octal - * represents a number or Hex digit
\x* Hex
\u* Unicode, e.g. \u2122 = ™ (trademark symbol)
class Example6 {
public static void main(String args[]) {
System.out.println("First line\nSecond line");
System.out.println("A\tB\tC");
System.out.println("D\tE\tF") ;
}
}
Predicted Output:
First Line
Second Line
A B C
D E F
.
Please if this post help comment below.
The following codes are used to represents codes or characters which cannot be directly accessible
through a keyboard:
Code Description
\n is use go to a new line N mean Line
\t is use to make a paragraph Tab
\b Backspace
\r Carriage Return
\\ Backslash
\’ Single Quotation Mark
\” Double Quotation Mark
It ise to add quote to a code or conmcom.
\* Octal - * represents a number or Hex digit
\x* Hex
\u* Unicode, e.g. \u2122 = ™ (trademark symbol)
class Example6 {
public static void main(String args[]) {
System.out.println("First line\nSecond line");
System.out.println("A\tB\tC");
System.out.println("D\tE\tF") ;
}
}
Predicted Output:
First Line
Second Line
A B C
D E F
.
Please if this post help comment below.
Comments
Post a Comment