• Post Reply Bookmark Topic Watch Topic
  • New Topic

Confusion in Propreties list method  RSS feed

 
Samar Bir
Greenhorn
Posts: 23
IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone.

I am new to java. I was reading Kathy and Bert book and here is an example from their book.



I understand Line 1&2. I am unable to understand the third line. Why we are giving complete System.Out to this methid?
Can someone explain this functionality.

Thanks.
Samar
 
Tony Docherty
Bartender
Posts: 3271
82
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System is a class which has a static field called 'out' which is of type PrintStream and is the "standard" output stream to the console.
The Properties class has a method called list that takes a PrintStream object as its parameter, which it then writes all it's properties to.
I'll leave you to work out the rest.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samar Bir wrote:Why we are giving complete System.Out to this methid?

Just to add to Tony's post:

What do you mean by "complete System.Out"? And what do you think might happen if you "give" this to a method?

System.out is simply a device that writes to your program's "standard" output (usually a a 'terminal' screen like CMD); it's not a "report", or a piece of data that gets stored somewhere. It's the output from your program, and it can't be overwritten unless you direct it somewhere that can be.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!