add two float values in java
- by user1845286
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