Possible Loss of Precision


Possible loss of precision” occurs when more information is assigned to a variable than it can hold. If this happens, pieces will be thrown out. If this is fine, then the code needs to explicitly declare the variable as a new type.
"possible loss of precision" error in Java
A “possible loss of precision” error commonly occurs when:
  • Trying to assign a real number to a variable with an integer data type.
  • Trying to assign a double to a variable with an integer data type.