The use of ! is illegal because x is of int type, not boolean.
public class MainClass { public static void main(String[] argv) {
int x = 1;
x = !x;
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The operator ! is undefined for the argument type(s) int
at MainClass.main(MainClass.java:5)