Possible loss of precision

Applies to:
NA

Description:
A variable of type double is assigned to int

Cause:
Example is:
double y = 3.14;
int x;
x = y;

admin JAVA-Compiler

  1. admin
    March 9th, 2009 at 18:22 | #1

    Use a type cast in assigning the variable.

    Example:
    double y = 3.14;
    int x;
    x = (int) y;

  1. No trackbacks yet.