我想知道是否可以在Eclipse中使用Java(或者更确切地说Java本身)只在调试模式下运行一段代码?就像在C++中一样: #ifdef DEBUG
// something to do
#else
// something else to do
#endif
我知道Java中没有预处理器,但也许有一些解决方法?
我有一个像下面的程序: // test.c
#include <stdio.h>
#define LOG printf
int main(int argc, char *argv[])
{
LOG("Hello, my name %s, my age %d\n", "John", 30);
LOG("I have wife and %d kids\n", 2);