Java JDK – possible lossy conversion from double to int

When you convert double to int,the precision of the value is lost. For example, When you convert 4.8657 (double) to int.The int value will be 4.Primitive int does not store decimal numbers.So you will lose 0.8657. In your case,0.7 is a double value(floating point treated as double by default unless mentioned as float-0.7f). When you calculate price*much*0.7 ,the answer is a double … Read more