Results 1 to 2 of 2
  1. #1
    SoullessWhale is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Default NumberFormat Class Question

    Its telling me it cant find getInstance() inside of the NumberFormat class. why?

    Java Code:
        public String convertString (int numberOfDigits) {
            
            //return the value of the Rational number up to the numberOfDigits fractional digits
            double toStr;
            toStr = (double)numerator / (double)denominator;    
    
            NumberFormat newForm = new NumberFormat.getInstance();
            newForm.setMaximumFractionDigits(numberOfDigits);
            newForm.setMinimumFractionDigits(numberOfDigits);
    
            stringNum = newForm.format(Double.toString(toStr));
            return stringNum;
        }

  2. #2
    SoullessWhale is offline Member
    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

Similar Threads

  1. A (very) simple question about NumberFormat in Applet
    By calnastic in forum New To Java
    Replies: 2
    Last Post: 06-17-2011, 04:34 AM
  2. NumberFormat which leave fractions as they are
    By itaipee in forum AWT / Swing
    Replies: 2
    Last Post: 12-09-2009, 07:11 PM
  3. using numberformat
    By roaan in forum New To Java
    Replies: 3
    Last Post: 07-02-2009, 05:28 AM
  4. NumberFormat is abstract?
    By DrKush in forum New To Java
    Replies: 4
    Last Post: 03-27-2009, 08:54 AM
  5. Parsing a number using a NumberFormat
    By Java Tip in forum java.text
    Replies: 0
    Last Post: 04-17-2008, 12:03 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
  •