Yogvinder is correct. The return from isvalid() is auto(un)boxed. Furthermore assertions can only be "enabled" at runtime. You will not get assertion errors at compile time. However the compiler will complain if the argument to assert() is not boolean/Boolean (assuming you are using JDK 1.4 upwards).