如何在 Eclipse 程序中启用 Java 关键字断言? [英] How to enable the Java keyword assert in Eclipse program-wise?

查看:29
本文介绍了如何在 Eclipse 程序中启用 Java 关键字断言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Eclipse 中启用 assert 关键字?

How can I enable the assert keyword in Eclipse?

public class A
{
    public static void main(String ... args)
    {
        System.out.println(1);
        assert false;
        System.out.println(2);
    }
}

推荐答案

具体来说:

  • 转到运行->运行配置
  • 在左侧导航面板中选择 java 应用程序.
  • 右键单击并选择新建.
  • 选择参数标签
  • 在 VM 参数中添加 -ea.

这篇关于如何在 Eclipse 程序中启用 Java 关键字断言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆