my dog learned polymorphism
The moose likes Beginning Java and the fly likes println() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "println() method" Watch "println() method" New topic

println() method

rajeshchowdary rajesh

Joined: Nov 21, 2007
Posts: 3
to access methods we can create ojects to the classes to which the method belongs .and by using objectname.methodname() we can access methods.But we are using System.out.println() why ? is there any other alternate to access println method ehich is in printstraem class?
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
java.lang.System is a class.

"out" is a static field of the System class. Being static, it exists independent of an instance of the System class. The type of "out" is

So, "System.out" gives you an instance of PrintStream, on which you are calling the method println().

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
I agree. Here's the link:
subject: println() method
It's not a secret anymore!