我装的1。5的jdk,好像不认assert这个关键字啊

解决方案 »

  1.   

    是单元测试用的,要引入jUnit的包,新建一个jUnit的类,就可以用了
      

  2.   

    要加选项的... -esa进行编译的...
      

  3.   

    Compiling Code with assert Statements
    Because previous versions of Java did not have an assert statement, you must inform the compiler that your code is to be compiled as Java 1.4 by including the following compile option in your javac command line: -source 1.4
    For instance:javac -source 1.4 AssertionDemo.javaRunning Programs with assert Statements
    You must explicitly turn assertions on in your code by using the -ea (-enableassertions) flag with your java command. For instance: java -ea AssertionDemo