How to enable the Java keyword assert in Eclipse program-wise?

前端 未结 6 833
无人共我
无人共我 2020-11-27 05:44

How can I enable the assert keyword in Eclipse?

public class A
{
    public static void main(String ... args)
    {
        System.out.println(1         


        
6条回答
  •  感情败类
    2020-11-27 06:09

    Java introduced the assert keyword, so the way to enable source-level support is to make sure that Eclipse's Java compliance level is 1.4 or higher. (The chances are that the compliance level is already higher than that ...)

    To cause a Java application launched from Eclipsed to run with assertion checking enabled, add the "-ea" argument to the VM arguments in the launcher configuration's "Arguments" tab.

提交回复
热议问题