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 7568935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:03:23+00:00 2026-05-30T15:03:23+00:00

Firstly regrets if this is a very basic question and i promote that I’m

  • 0

Firstly regrets if this is a very basic question and i promote that I’m still a code monkey.
I was asked in an interview to elucidate System.out.println();
I explained the following way

//this class belongs to java.lang package
class System{
  public static PrintStream out;
}
//this class belongs to java.io package
class PrintStream{
 public void println..
}

I’ve explained that System.out is valid since this is the way we access static variables in java, and out is an object of PrintStream and hence we can access its methods, In sum as

System.out.pritnln(); 

he asked me to simulate a similar kind of program,i traced and it did not work,since System.out is returning null

my question is where is out object instantiated in java ? Is it a predefined object if I’m not wrong. what should be the meticulous explanation for this.

Technically what should we call out? Is out a variable of type PrintStream type or should one say it as an object of type PrintStream ?

  • 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-30T15:03:24+00:00Added an answer on May 30, 2026 at 3:03 pm

    System.out is initialized to null when the class is instantiated. This is set by the nullPrintStream() method in System.java, which just returns null.

    When the JVM has initialized, it calls the initializeSystemClass() method. This method calls the native method setOut0() which sets the out variable to the appropriate value.

    This may seem weird but it is a necessary operation for the following reasons:

    • out cannot be set statically to the value because System needs to be one of the first loaded classes (before PrintStream).
    • out must be final so that its value cannot be directly overridden by a user.
    • Since out cannot be set statically, and is final, we must override the semantics of the language using a native method, setOut0().

    I hope that helps your understanding.

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

Sidebar

Related Questions

Firstly apologies if this a very basic question, I'm just curious to know the
Firstly I realise that this is a familiar question, it seems to pop up
Firstly, YES, this is a duplicate issue that's been asked 100 times on here,
Firstly I know that there are many question and solutions to correct thread marshalling
Firstly, I do not have any malicious intent out of this question. I would
Firstly, sorry about the question title, it may not be very descriptive for my
Firstly, let me just say that I'm very new to JSR-170 and Jackrabbit/Lucene in
firstly, pardon my pseudo-code, i think in this case it is more legible than
Firstly, this is a homework assignment, and I am very new to programming in
Firstly, let me say that I've been on this issue for pretty much 2

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.