Results 1 to 7 of 7
  1. #1
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default [SOLVED] [newbie] PrintStream printf(String fmt, Object... args)

    A book example...I'm trying to guess...

    public static class PrintStream
    {
    public PrintStream printf(String fmt, Object... args);
    }

    1. Can I convert PrintStream to an object that I can display on screen (ahem...the default stream writer), say, using System.out.println.

    2. What values do I need to set for 'fmt'?

    :confused:
    Last edited by jon80; 05-19-2009 at 12:03 PM.

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    804
    Rep Power
    6

    Default

    fmt param u can give collection of characters or mixed (i.e) numeric+characters.

    Ex: "Ramya","Ramya78" etc....

    Go thru this Javdoc
    http://java.sun.com/j2se/1.4.2/docs/...ng/String.html
    Last edited by RamyaSivakanth; 05-19-2009 at 11:18 AM.
    Ramya:cool:

  3. #3
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    lol, no read my question :P

  4. #4
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    804
    Rep Power
    6

    Default

    Could you please explain the problem clearly? Instead of passing to S.O.P u can use println of printstream directly know?
    Last edited by RamyaSivakanth; 05-19-2009 at 11:35 AM.
    Ramya:cool:

  5. #5
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    imho it is clear

  6. #6
    jon80's Avatar
    jon80 is offline Senior Member
    Join Date
    Feb 2008
    Location
    Malta (EU)
    Posts
    211
    Rep Power
    7

    Default

    I've re-thought my question as...

    How do I use the function printf()?

    ...Although actually there are specific questions I was worried about before I get to that...

    1. Can I convert PrintStream to an object that I can display on screen (ahem...the default stream writer), say, using System.out.println.

    2. What values do I need to set for 'fmt'?


    Hope this is somewhat clearer...
    Last edited by jon80; 05-19-2009 at 12:06 PM.

  7. #7
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    804
    Rep Power
    6

Similar Threads

  1. Why can't we write main without String args[]
    By shailender in forum New To Java
    Replies: 6
    Last Post: 06-17-2013, 09:28 AM
  2. String[] arg and String... args
    By mahendra.athneria in forum Advanced Java
    Replies: 4
    Last Post: 04-28-2009, 07:20 PM
  3. Replies: 9
    Last Post: 11-22-2008, 11:03 PM
  4. [SOLVED] ReadLine(String fmt,Object... args) of Console class
    By Pooja Deshpande in forum New To Java
    Replies: 4
    Last Post: 04-25-2008, 05:51 AM
  5. (newbie) String doesn't compile?!
    By jon80 in forum New To Java
    Replies: 5
    Last Post: 04-09-2008, 08:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •