Someone please explain me how the below code prints 8.800000095367432.
class Test
{
public static void main(String[] args)
{
Double object = new Double("2.4");
int a = object.intValue();
byte b = object.byteValue();
float d = object.floatValue();
double c = object.doubleValue();
System.out.println(a + b + c + d );
}
}
Dear Pavel,The question in another link regards to javascript. I was wondering how is it in Java.
To make it more clear, The below one prints 6.4
Double object = new Double("2.4");
int a = object.intValue();
byte b = object.byteValue();
double c = object.doubleValue();
System.out.println( a+c+b);
Where as,
Double object = new Double("2.4");
int a = object.intValue();
byte b = object.byteValue();
double c = object.doubleValue();
float d = object.floatValue();
System.out.println(a + c + b + d);
prints 8.800000095367432.