- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Escape sequences in Java
A character preceded by a backslash (\) is an escape sequence and has a special meaning to the compiler.
The following table shows the Java escape sequences.
Escape Sequence | Description |
---|---|
\t | Inserts a tab in the text at this point. |
\b | Inserts a backspace in the text at this point. |
Inserts a newline in the text at this point. | |
\r | Inserts a carriage return in the text at this point. |
\f | Inserts a form feed in the text at this point. |
\' | Inserts a single quote character in the text at this point. |
\" | Inserts a double quote character in the text at this point. |
\ | Inserts a backslash character in the text at this point. |
Let us see an example of Character Escape Sequences in Java.
Example
public class Demo { public static void main(String[] args) { char ch = '\u039A'; System.out.println(ch); } }
Output
K
- Related Articles
- Escape sequences in C
- What are the escape sequences supported by C#?
- How to process escape sequences in a string in Python?
- How can I remove the ANSI escape sequences from a string in python?
- JavaScript escape()
- Escape Characters in Python
- Escape characters in JavaScript
- The "" escape character in C#
- Escape The Ghosts in C++
- Build (escape) regexp in MongoDB?
- Validate Stack Sequences in C++
- Repeated DNA Sequences in C++
- How to escape single quotes in MySQL?
- How to escape apostrophe (') in MySQL?
- Ways to print escape characters in C#

Advertisements