When I try to get the answer for the (14.99 + 1.5) and (15.99 + 1.5) my programs gives me the different output which I didn't expect. Any reason for that?
Here is my simple program:
class Demo {
public static void main(String[] args) {
System.out.println(12.99 + 1.5);
System.out.println(13.99 + 1.5);
System.out.println(14.99 + 1.5);
System.out.println(15.99 + 1.5);
System.out.println(16.99 + 1.5);
}
}
Here is the output :
My JDK version : 1.7.0_25