4.2.26.To assign a double value to an integer type
//attempting a narrowing conversion and the compiler knows it
class MainClass{ public static void main(String [] args) { int x = 3.229; // illegal
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from double to int
at MainClass.main(MainClass.java:3)