如何标记java代码,使其不被编译 [英] How to mark java code such that it's not compiled

查看:112
本文介绍了如何标记java代码,使其不被编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否存在与C的Java等价物

I'm wondering if there if a Java equivalent for C's

#if 0
... Some Code ...
#endif

可以在我们不使用的代码块周围使用想要编译。添加块报价:

Which can be used around code blocks we don't want to compile. Adding block quotes:

/*
... Some Code ...
*/

也有同样的效果,但问题是,我们必须确保没有单行注释

also has the same effect, but the problem is, we have to ensure there are no single line comments

// some comment


$ b块中$ b

in the block.

推荐答案

Java中没有预处理器指令。您最好的选择是评论代码。

There are no pre-processor directives in Java. Your best choice is commenting out code.

这篇关于如何标记java代码,使其不被编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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