Skip to content

Instantly share code, notes, and snippets.

@lsegal
Created May 27, 2014 18:21
Show Gist options
  • Save lsegal/468373375088dbd4ebe5 to your computer and use it in GitHub Desktop.
Save lsegal/468373375088dbd4ebe5 to your computer and use it in GitHub Desktop.
~$ javac Test.java
Test.java:5: error: possible loss of precision
x = 2.345f;
^
required: int
found: float
Test.java:6: error: possible loss of precision
x = y;
^
required: int
found: float
2 errors
public class Test {
public static void main(String[] args) {
int x;
float y = 2.345f;
x = 2.345f;
x = y;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment