Results 1 to 11 of 11
  1. #1
    nonybrighto is offline Member
    Join Date
    Oct 2012
    Location
    ph
    Posts
    43
    Rep Power
    0

    Default formatter shows nothing

    please i need some help in printing the formatted data out in the text file named acc.txt but it doesnt work ....it builds but the text file remains empty.
    Please help me...where am i wrong?

    import java.util.Formatter;

    public class make acc
    {
    public static void main(String[] args)
    {
    Formatter make;
    make = new Formatter("C:\\acc.txt")
    make.format("%s\n%s","i love java","i know duke");
    }

    }
    joy wouldnt feel so gud if it wasnt for pain

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,000
    Blog Entries
    7
    Rep Power
    20

    Default Re: formatter shows nothing

    Close the formatter before you exit your program (read the API documentation for the Formatter class). b.t.w. a class name cannot have spaces in them.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    nonybrighto is offline Member
    Join Date
    Oct 2012
    Location
    ph
    Posts
    43
    Rep Power
    0

    Default Re: formatter shows nothing

    that is just a mistake i made while typing it in here....anyway i'll check it out...thanks a lot!!
    joy wouldnt feel so gud if it wasnt for pain

  4. #4
    nonybrighto is offline Member
    Join Date
    Oct 2012
    Location
    ph
    Posts
    43
    Rep Power
    0

    Default Re: formatter shows nothing

    please help me bro ..i have searched and didnt see a topic for it. My problem isnt with the syntax
    joy wouldnt feel so gud if it wasnt for pain

  5. #5
    ieee488 is offline Member
    Join Date
    Dec 2012
    Posts
    12
    Rep Power
    0

    Default Re: formatter shows nothing

    Quote Originally Posted by nonybrighto View Post
    My problem isnt with the syntax
    really?

    public class make acc doesn't make sense to me

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,000
    Blog Entries
    7
    Rep Power
    20

    Default Re: formatter shows nothing

    Don't ignore what I wrote above: close the Formatter before your program exits.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    nonybrighto is offline Member
    Join Date
    Oct 2012
    Location
    ph
    Posts
    43
    Rep Power
    0

    Default Re: formatter shows nothing

    i made a mistake while typing here but apart from the syntax error is there anything i did that will make it compile without giving an output in acc.txt or please can i get a tutorial link i searched and didnt get any help
    joy wouldnt feel so gud if it wasnt for pain

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,000
    Blog Entries
    7
    Rep Power
    20

    Default Re: formatter shows nothing

    sigh ... invisible ink again ...

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    ieee488 is offline Member
    Join Date
    Dec 2012
    Posts
    12
    Rep Power
    0

    Default Re: formatter shows nothing

    Quote Originally Posted by nonybrighto View Post
    but apart from the syntax error is there anything i did that will make it compile without giving an output in acc.txt
    You don't consider a sytax error to be a problem ?

  10. #10
    nonybrighto is offline Member
    Join Date
    Oct 2012
    Location
    ph
    Posts
    43
    Rep Power
    0

    Default Re: formatter shows nothing

    No...what i'm trying to say is that i typed this one saperately...but the one in my IDE has no syntax error...anyway thanks a lot...i found another way of making the text file..
    joy wouldnt feel so gud if it wasnt for pain

  11. #11
    ieee488 is offline Member
    Join Date
    Dec 2012
    Posts
    12
    Rep Power
    0

    Default Re: formatter shows nothing

    Quote Originally Posted by nonybrighto View Post
    No...what i'm trying to say is that i typed this one saperately...but the one in my IDE has no syntax error...anyway thanks a lot...i found another way of making the text file..
    That is as clear as mud.

Similar Threads

  1. How to do this with Java Formatter?
    By ozzyman in forum New To Java
    Replies: 2
    Last Post: 05-13-2011, 11:33 PM
  2. Developing Word Writter and Formatter
    By Anchal in forum AWT / Swing
    Replies: 1
    Last Post: 04-06-2010, 03:35 AM
  3. Formatter with JOptionPane
    By sweetpea123 in forum Advanced Java
    Replies: 12
    Last Post: 03-28-2010, 07:19 PM
  4. JFormattedTextField / Formatter / OverWriteMode
    By Ralphw in forum AWT / Swing
    Replies: 1
    Last Post: 08-20-2009, 11:23 AM
  5. Using java.util.Formatter
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-16-2007, 02:29 PM

Posting Permissions

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