Results 1 to 2 of 2

Thread: Format number in java

  1. #1
    CoxWatson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    232
    Rep Power
    3

    Default Format number in java

    Hi. I am last year MBA student. Currently I am learning java programming language. I want to show number in specific format. If you have any codes then send it to me. It is highly appreciated.

  2. #2
    BrooksGray is offline Senior Member
    Join Date
    Dec 2009
    Posts
    231
    Rep Power
    3

    Default

    I suggest you to refer following example of NumberFormat and DecimalFormat class, which will give you something idea about the use of this class:

    Code:
    import java.text.DecimalFormat;
    import java.text.NumberFormat;
     
    public class DecimalFormat
    {
     			   public static void main(String[] args)
        			{
           		 	NumberFormat F1 = new DecimalFormat("#0.00");
         				 System.out.println(M);
           
           			System.out.println(F1.format(M));
      		  	}
    }

Similar Threads

  1. Java code palindrome number
    By AllenBrown in forum Programming
    Replies: 2
    Last Post: 06-14-2010, 02:18 PM
  2. C code for given number is Armstrong number or not
    By RussellBarnes in forum Programming
    Replies: 1
    Last Post: 05-29-2010, 12:01 PM
  3. Replies: 2
    Last Post: 05-14-2010, 01:30 PM
  4. Code for sum of odd number and even number separately in c
    By EvansMitchell in forum Programming
    Replies: 2
    Last Post: 05-10-2010, 02:06 PM
  5. Format number in java
    By DavisMartin in forum Programming
    Replies: 1
    Last Post: 01-21-2010, 03:13 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48