Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5940847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:01:33+00:00 2026-05-22T16:01:33+00:00

When we want to print line in console we write System.out.println(data), what will be

  • 0

When we want to print line in console we write System.out.println(data), what will be difference if we use PrintStream object out and use out.println(data).

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:01:34+00:00Added an answer on May 22, 2026 at 4:01 pm

    Why do we need System class to call out.println() method?

    We don’t. It is just a convenient way to get hold of the PrintStream object for writing to standard output.

    … what will be difference if we use PrintStream object out and use out.println(data).

    It depends on how you obtained the PrintStream object.

    • If you originally got the PrintStream object from System.out or System.err, then there is no difference; e.g. the following have the same effect:

      public void sayHello(PrintStream ps) {
          ps.println("hello");
      }
      sayHello(System.out);
      System.out.println("hello");
      
    • If you created the PrintStream on a stream that opened yourself, the behaviour will be analogous, but the output will (most likely) go to a different place; e.g.

      sayHello(new PrintStream(new FileOutputStream("foo.txt"));
      

      will write “hello” to the named file.

    There is nothing special about System.in/out/err. They are just public static final variables that are initialized to specific stream objects when the JVM starts. (OK, there is something slightly unusual about them … but it doesn’t manifest here.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, if you want to write out a line to the console in F#,
I want to print modulus operator as it is over the command line: E.g
I want to search each line for the word FAILED , then print the
I want to print the entire the SVG document in the console..like... <svg id=mainSVG>
I want to print out some debug messages in my erb template when it
Hi I want to store whole console out put generated by all steps of
I want to write the following two lines on the console: x = 3
I simply want to read a file and output it in the console. print(
I want the following following node.js program to read a file and print out
I want to use a linux command line tool from my Java program. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.