Escape Sequence in Java

Get Into Code provides you with free C++ and Java Course in Hindi/Urdu and also provides you the opportunity to practice your skills to be perfect. In the previous video we have discussed about the Character Datatype in Java. In this video we are going to discuss about Escape Sequence in Java.
Escape Sequence in Java
Escape Sequence are used to made programming easier and better for programmers in different Languages such as C++, Java . In basic Syntax of Java of have seen that how the "ln" keyword works. It is used to end the current line and move the cursor on to Next Line. But when we have to end a line for many times then it is not a good practice to use the ln keyword. For Instance
Code Output
System.out.println("Long");
System.out.println("Live");
System.out.println("Pakistan");
Long
Live
Pakistan
Instead of this programmer practice to use \n to end the current line and move the cursor to the Next Line. For instance we can write System.out.println("Long\nLive\nPakistan"); to get the same output.

Watch The Video Below To Understand Some More Escape Sequence in Java



The best about our site is that we provide our readers to practice their skills because Practice Puts Brain in Your Muscles. So, Go Ahead and Write a Java program which print the word PAKISTAN as

P
A
K
I
S
T
A
N

Answer the Following Question to know how much you have learnt?
  1. What does the "endl" do?
    1. End the Line
    2. Move the Cursor to the next Line
    3. Both of These
  2. Which Character is used for Escape Sequence?
    1. \n
    2. \
    3. \t
  3. To remove last letter in any word, we use
    1. \e
    2. \b
    3. \n
  4. Write only a code to cout
    "2+2"
  5. Write only a code to cout
    Pakistan's Flag

No comments

Powered by Blogger.