This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Guys, till now i was working on 1.2.2 version and today to test few assert examples, i D/L 1.4.2. Wrote the below program but it is giving errors while i try to compile. Compiler errors are ]
D:\JAVACE~1\ASSERT~1>javac test145.java test145.java:7: warning: as of release 1.4, assert is a keyword, and may not be used as an identifier assert true; ^ test145.java:7: not a statement assert true; ^ test145.java:7: ';' expected assert true; ^ 2 errors 1 warning
When i check the java version it is showing 1.4.2 only. PLEASE HELP
D:\JAVACE~1\ASSERT~1>java -version java version "1.4.2_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03) Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode) [/QUOTE
Hi Sekhar When you run your program on sdk 1.4 or above, u have a possibility to use assertion, but you should diasable them, 'cause by default they are not! in compilation you should tape > javac -source 1.4 Example.java and for running > java -ea Example.class hope u understood me!
Joined: Feb 17, 2004
Hey, Thanks fethi. I wass home today and read the K&B for this. It also says the same. So tomorrow i am gonna try that. I can't wait any more. Its just 3 more days!!!