add two float values in java
        Posted  
        
            by 
                user1845286
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user1845286
        
        
        
        Published on 2012-11-23T04:42:52Z
        Indexed on 
            2012/11/23
            4:59 UTC
        
        
        Read the original article
        Hit count: 223
        
translation
acually i try to add two float values in java like this
import java.text.DecimalFormat;
class ExactDecimalValue
{
 final strictfp static public void main(String... arg)
 {
       float f1=123.00000f;
       float f2=124.00000f;
       float f3=f1+f2;
       System.out.println(f1+f2);
       System.out.println("sum of two floats:"+f3);
/*my expected output is:247.00000
   but comming output is:247.0   and 247*/
 } 
}
Now what i can do to get the value in this format:247.00000. please any one help me.
Thanks & Regards venkatesh
© Stack Overflow or respective owner