Javatpoint Logo
Javatpoint Logo

Form Feed in Java

Form feed character is one of the escape sequence characters it is denoted by "\f". It is an old strategy and used to show a page break.

Example

Output:

Form Feed in Java

Escape Sequences in Java

A character with an oblique punctuation line (\) not long before it is an escape sequence or escape character. We use escape sequence to play out some specific task. Unquestionably the quantity of departure characters or break arrangements in Java is 8. Each getaway character is a substantial person strict.

Example program to show the use of escape sequences:

Output:

Form Feed in Java

This happened in light of the fact that the compiler expects only possibly strings inside the quote, yet when the compiler finds a quote, it expects another quote sooner rather than later (the end one), and between them, the line of text ought to be made. During this case, the quotes "Welcome to JavaTpoint tutorials and examples" gets nested (inside other quotes). When the compiler arrives here, the compiler gets befuddled. As per the standard, the quote recommends the compiler for making a string, yet the compiler was occupied with doing that thing beforehand, and the code gives us a compile-time blunder.

So we ought to give appropriate directions to the compiler about the quote. i.e., when a citation is utilized for making a string (as an order) and when it is a person itself (the piece of the result string).

Comparable kinds of disarray emerge with different characters also (like backslashes (), single and twofold quote (', ")), and these likewise give a compile time blunder for each situation. To address such issues, we need to utilize the java character away.

Control Sequences

A control sequence isn't anything anyway. The backslash(\) stuck with a person (the character which must be gotten away) is known as a control sequence.

Example

Output:

Form Feed in Java

Types of Escape Sequences

1. \t: It is utilized to embed a tab in the text between the words.

Example program for \t in java

Output:

Form Feed in Java

2. \b: The escape character \b is a delete character It moves the cursor one character back despite everything erasing the character(depending upon the compiler)

Example program for \bin Java:

Output:

Form Feed in Java

3. \n: \n is used to print the sequence of the character of a character in the new line.

Example program for\n in java

Output:

Form Feed in Java

4. \r: This \r get away from succession is a carriage return character. It moves the result guide back toward the start of the line without dropping down the line (for the most part).

Example program for \r in java

Output:

Form Feed in Java

5. \f: This \f escape character is a form feed character. It is an old strategy and used to show a page break.

Example program for \fin java

Output:

Form Feed in Java

6. \': This \' escape character is for displaying a solitary quote on the text string

Example program for \' in java

Output:

Form Feed in Java

7. ": This \' escape character is for displaying a two-fold quote on the text string.

Example program for \" in java

Output:

Form Feed in Java

8. \\: This \\ escape character is used to display a backslash line on the text string in the output screen.

Example program for \\

Output:

Form Feed in Java

It contains two oblique punctuation lines. This implies subsequent to perusing the first \. The compiler read the following \ as another character.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA