This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Overloading  System.out.println(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Overloading  System.out.println();" Watch "Overloading  System.out.println();" New topic

Overloading System.out.println();

Prasath Manohar

Joined: Mar 21, 2006
Posts: 2
Is it possible to overload an object,can I overload System.out ?
Ashutosh Limaye
Ranch Hand

Joined: Oct 24, 2005
Posts: 58
Check out the System class in docs....see what an out object is...
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60755

Prasath Manoha, please take more care in chosing which forum in which to post your questions. This forum is for JDBC questions.

I've moved this post to Java in General (beginner).

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
Originally posted by Prasath Manohar:
Is it possible to overload an object,can I overload System.out ?

Overloading an object? How do you that?

I see some people assigning System.out object to some referene and call println method on that reference.

for example: ps = System.out;
ps.println("Hello world");
Manesh Kumar
Ranch Hand

Joined: Mar 21, 2006
Posts: 94
Originally posted by Prasath Manohar:
Is it possible to overload an object,can I overload System.out ?

I think you are expecting to use different stream to print rather than the console.

If thats is the case,

You can use System.setOut(PrintStream);

For printing all the System.out.println() to a file.

System.setOut(new PrintStream(new FileOutputStream("console.log")));

Of course, this will no more print to the console for all System.out.println().
[ March 22, 2006: Message edited by: Dilip Kumar Jain ]

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Note that the above has nothing to do with overloading at all.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
subject: Overloading System.out.println();
Similar Threads
WA #1.....word association
about finalize method?
Why didn't java support operator overloading
can a class or a java file have more than one "main "method?