Sunday, August 30, 2015

Common Escape Sequence In Use

Hi All...!

Today I'm going to show you how to use some commonly used escape sequence in Java program.

Let's take a look at what are the commonly used escape sequences,

"\n" newline character 


This escape sequence use to move cursor to the beginning of the next line,

Let's see how to use this escape sequence,



And this is the output,





Let's try this code with "print",



then the output,




"\t" Horizontal Tab


By using this escape sequence we can move cursor to right with tab space,

Let's use this in code,




Output,






"\r" Carriage return



By using this escape sequence we can position cursor at the beginning of a line and the text before this escape sequence will overwrite with text after the escape sequence,

Let's try this in code,





This is the output,





"\\ Backslash"


Use to print backslash,

Let's see how to use this,




Output,




" \" " Double Quote



Use to print double quotes, Let's see the code,






Output,



No comments:

Post a Comment