Drokle Posted October 6, 2017 Share Posted October 6, 2017 I'm new to Java programming, although luckily it's similar enough to C/C++ that I am so far having no difficulties. However, one thing I used a lot in C is the preprocessor, which allows you to specify build options in a way that makes it easy to switch on or off different builds. The preprocessor runs at build time before the compiler and you can pass it options to do certain things, most commonly define substitution macros. As an example, you have something like #define __DEBUG_BUILD__ //#undef __DEBUG_BUILD__ /* Switch debugging on or off at build time */ #ifdef __DEBUG_BUILD__ #define log_info( /* Whatever variables you want */ ) /* Some code to substitute for log_info */ #else #define log_info /* log_info is now a blank expression - no debug info will be logged */ #endif Does Java have something similar to the C preprocessor? Quote Link to comment Share on other sites More sharing options...
Satire Posted October 6, 2017 Share Posted October 6, 2017 Java does not have such a thing as It's a higher level language. Just declare it as a (public)static final and boom, there you go Reason: Java doesn't have a precompiler. I know it will be annoying to wrap your head around but eventually, you'll get used to it. You could make your own version of it using classes and all, but it won't make any difference since the won't preprocess it anyway... Quote Link to comment Share on other sites More sharing options...
Drokle Posted October 6, 2017 Author Share Posted October 6, 2017 I see, well thanks anyway! ~Drokles Quote Link to comment Share on other sites More sharing options...