Myeclipse assert settings

Source: Internet
Author: User

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 " );
}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.