Results 1 to 3 of 3
  1. #1
    calnastic is offline Member
    Join Date
    Jun 2011
    Posts
    18
    Rep Power
    0

    Unhappy A (very) simple question about NumberFormat in Applet

    Hi, I have this very simple code with some errors I can't figure out why.
    Please advise.
    Thanks.

    Java Code:
    import java.applet.Applet;
    import java.text.NumberFormat;
    
    
    public class test extends Applet  {
    
        NumberFormat form = NumberFormat.getInstance();
    
        form.setMinimumIntegerDigits(3); // error at the decimal point and 3
        form.setMinimumFractionDigits(2); // error at the decimal point and 2
        form.setMaximumFractionDigits(4); // error at the decimal point and 4
      
    }

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,762
    Rep Power
    7

    Default

    Those lines of code need to be in a method or a constructor or an initialiser block. Currently you have them where you declare instance variables.

  3. #3
    calnastic is offline Member
    Join Date
    Jun 2011
    Posts
    18
    Rep Power
    0

Similar Threads

  1. at java.lang.NumberFormat.Exception.forInputString?
    By awesomeness in forum New To Java
    Replies: 24
    Last Post: 10-24-2010, 12:08 AM
  2. NumberFormat which leave fractions as they are
    By itaipee in forum AWT / Swing
    Replies: 2
    Last Post: 12-09-2009, 06:11 PM
  3. using numberformat
    By roaan in forum New To Java
    Replies: 3
    Last Post: 07-02-2009, 04:28 AM
  4. NumberFormat is abstract?
    By DrKush in forum New To Java
    Replies: 4
    Last Post: 03-27-2009, 07:54 AM
  5. Parsing a number using a NumberFormat
    By Java Tip in forum java.text
    Replies: 0
    Last Post: 04-16-2008, 11:03 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
  •