Java programming course: 5.2 Understanding System.out.println

In the previous lesson we looked at static members.


Understanding System.out.println()

You have several times used the System.out.println() statement to send text to the Output window, and its syntax looks slightly unusual in that there are two dots. If you look at the API for the System class, you will see the following:

  • That out is a public variable (you will find it under the Field Summary section) and therefore available to be referenced from other classes. The variables you have so far created have all been private, and this is the normal situation. However, this shows that occasionally it can be useful for variables to be public
  • That out is declared to be static, meaning that you don't need to instantiate a System object to use it
  • That out is declared as final, meaning its reference cannot be modified
  • That out is a variable of type PrintStream
  • If you now click the PrintStream link you will find several methods including one called println and which takes an argument of type String.

You can therefore read the statement as being: "Invoke the println() method of the out static variable that is a PrintStream object that exists within the System class".


In the next lesson you will learn about Java constants.

Next lesson: 5.3 Constants


Print
×
Stay Informed

When you subscribe, we will send you an e-mail whenever there are new updates on the site.

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment
Saturday, 13 December 2025

Captcha Image