Thursday, June 23, 2011

Using System.out.print(ln?)()

I often use System.out.println and its sister, System.err.println.

However, I'd like to be able to easily switch the type of output my program emits, between not just stdout and a file, but also different formats, each of which would subclass BufferedWriter in order to produce the write format.

I don't know though, because then I'm either trying to return strings from each of my classes, or each class has to have access to the output stream, or I end up passing the output stream around a lot.

3 comments:

  1. we are calling the println() from PrintStream Class without instanciating it. Do u know how ?? :)

    ReplyDelete
  2. I'm not sure, Kumar, but can I have a code sample so I know I understand the situation completely before I try to answer? :D (I'm hooked on your blog puzzles, btw; I'm still working on the first String one.)

    ReplyDelete
  3. Cool… I will be happy if you follow my blog… by the ways I don’t get any notifications on your comment here. i can explain my puzzles if u r interested.

    Kumar,
    http://kumkumaa.blogspot.com/

    ReplyDelete