Start assert in myeclipse)
Choose WINDOW> preferences> JAVA> compiler> compliance and classfiles in myeclipse8.
Assertions are added in jdk1.4 of Java. By default, the assertion function of JVM is disabled.
This setting tells the compiler to recognize and allow asserted statements, but no assertions have been enabled.
Next, go to the menu item WINDOW> preferences> JAVA> compiler> compliance and classfiles, and set:
Compiler compliance level: 1.6
Use default compliance settings: unchecked
Generated. class files compatibility: 1.6
Source compatibility: 1.6
Disallow identifiers called 'assert ': Error
LastIn the VM arguments area of the run-> Run...> arguments menu item, add the Enable assertion flag.
-Enableassertions or-ea.
Or execute the command line encoding:
Java-EaProgramName
E.g .:
Public Static Void Main (string [] ARGs ){
Int A = 1 , B = 2 ;
Assert True ;
System. Out. println ( " Assertion successful " );
Assert 4 = A + B: " Assertion failed " ;
System. Out. println ( " Done " );
}