public static void main(String[] args) {
double firstDouble = 1.8d;
double secondDouble = 1.65d;
float firstFloat = 1.8f;
float secondFloat = 1.65f;
System.out.println("DOUBLE SUM : "+(firstDouble + secondDouble));
System.out.println("FLOAT SUM :"+(firstFloat + secondFloat));
System.out.println("DOUBLE SUM"+firstDouble + secondDouble);
System.out.println("FLOAT SUM"+firstFloat + secondFloat);
}
OUT PUT:
DOUBLE SUM : 3.45
FLOAT SUM :3.4499998
DOUBLE SUM :1.81.65
FLOAT SUM :1.81.65
my questions
1) In the first set of out put why it is giving different values 3.45
and 3.4499998
for the same values
2) In the second set of out put why the out put is different from first out put.
Thanks in advance...