import java.text.*;

class Case_1 {
    NumberFormat curr;

    public Case_1( ) {
    double Amount = 2343.1

      try {
            curr = NumberFormat.getCurrencyInstance();
            System.out.println( "Dollar amount: " + curr.format(Amount) );
        } catch (IllegalArgumentException e) {}

     }
}





Daniel Lynn <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 11/10/2000 02:09:06 PM

Please respond to "A mailing list for discussion about Sun Microsystem's Java
      Servlet API Technology." <[EMAIL PROTECTED]>

Sent by:  "A mailing list for discussion about Sun Microsystem's Java Servlet
      API Technology." <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  numberformat


OK, so I've been staring at my Nutshell book for a few hours now and the
whole NumberFormat class doesn't seem to be getting any less
confusing... currently, my price variables come up as 1 digit after the
decimal ($8.0 instead of $8.00 for example). I know numberformat can
format to currencies, but I can't figure out how to implement it since
it can't be instanciated. Anyone know either how to use the class or if
there is another way around it? thanks much.

-Daniel

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to