In C/C++ we can use #ifndef RELEASE #endif
to include debug source such as some extra tests and/or console print and etc
Is there any way to do it in java or any similiar alternative ?
You can add a static final boolean
variable and then use simple if
statements.
If the compiler can determine that the expression is false
then it will not compile the conditional into your code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.