Originally posted by Abhishek Reddy Chepyala:
float i=0.7f;
if(i<0.7)
System.out.println("hello");
else
System.out.println("world");
the output of this code is hello
why not world???
By default 0.7 is double. So the precision of Double is more then Float.
Try out this program.
You will have a clear view of the problem.
Hope this helps you out.