assert

By default (that is, in the absence of the -source 1.4 switch), a J2SE 1.4 compiler does not allow assert statements

Above is the exact wording from a book.

But i am able to compile class containingassert statement without the use ofjavac -source 1.4 Foo.java by just using

javac Foo.java. I am not getting any warning or error.

[390 byte] By [jaaya] at [2007-10-2 20:25:49]
# 1
can u post that code?and the book name where u saw this?
Caliguardoa at 2007-7-13 23:08:46 > top of Java-index,Java Essentials,New To Java...
# 2
In my understanding they are compiled but as void (comment) if not enabled.
BIJ001a at 2007-7-13 23:08:46 > top of Java-index,Java Essentials,New To Java...
# 3
My friend just check your compiler if it is tiger java or java 1.5 that you are using.
ice_cool_heada at 2007-7-13 23:08:47 > top of Java-index,Java Essentials,New To Java...
# 4
I am using java 1.5
jaaya at 2007-7-13 23:08:47 > top of Java-index,Java Essentials,New To Java...
# 5
> I am using java 1.5To quote your first post 2SE 1.4 compiler. You are not using a 1.4 compiler, you are using a 1.5 compiler. That defaults to 1.5 (where as 1.4 defaults to 1.3, or 1.4 minus assert or somesuch).
mlka at 2007-7-13 23:08:47 > top of Java-index,Java Essentials,New To Java...