White space character– java program

About White space character in java

We already know about white space character in C and Cpp. Java has white space character list like \n – new line, \t – tab space, \r – carriage return, \b – blank space etc. These are basic character set in java. In this blog we will discuss different between print() and println() methods. Lastly, we will discuss how to write string in double “” in output screen.

Program Title:
[ Simple white space character program ]
Program:

class ex2
{
public static void main(String args[])
{
System.out.print(“Welcome”);
System.out.println(” in”);
System.out.println(” Java\n\n”);
System.out.println(” Ja\tva”);
System.out.println(” Ja\rva”);
System.out.println(” Ja\bva”);
System.out.println(” \”Ja\”va”);
}
}


Output:

Welcome in
Java

Ja va
va
Jva
“Ja”va


Output Information:

1. First line do not use println() method so, output of first and second line merge.
2. Third line uses println() method and two time \n, so output will be in two line break.
3. Fourth line has \t, so we can see space between ‘Ja’ and ‘va’.
4. Fifth line has \r, so we can see remove all character before \r.
5. Sixth line has \b, so we can see remove one character before \b.
6. Seventh line has \”, so we can see double “” on “Ja”.


Video available on YouTube


Tutorial List

Program 1
* * * * *
*          *
*          *
* * * * *

Program 2
Joy Tibyani
“Monica Gallener”
Rachel


About Tutorial
Send your tutorial task on ectvcindia@gmail.com. We will check in 24 hours. And give more tips on it.

First Simple Program | How To Run | Software Information

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

220total visits,4visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image

EmailEmail
PrintPrint