PrintWriter Class in IO Management

PrintWriter class is one* package’s class. Using of this class we can reduce our code.

PrintWriter pw = new PrintWriter(System.out,true);

This is statement of creation an object of PrintWriter Class. In the parameter we found System.out and true values.

System.out and true indicate that we can use pw object instead of System.out.


System.out.println(“Welcome in Portal Isssearch”);

We can write this line like

pw.println(“Welcome in Portal Isssearch”);


Note:  PrintWriter class works only on println() method and does not work on print()

Example on PrintWriter class with Videos


class io4


                public static void main(String args[]) throws IOException


                                PrintWriter pw = new PrintWriter(System.out,true);


                                pw.println(“Welcome in Java IO1”);        

                                pw.println(“Welcome in Java IO2”);        

                                pw.println(“Welcome in Java IO3”);        

                                //System.out.println(“Welcome in Java IO”);     

// If you want to use println() method that time you have just use pw object insted of System.out




Welcome in Java IO1

Welcome in Java IO2

Welcome in Java IO3


View and subscribe this video on YouTube.



If you have any query on blog example, you can directly comment us or subscribe our website

Earn Money Online

Share and Enjoy

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

349total visits,6visits today


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.


Link back if you want.

Enter Captcha Here :*

Reload Image