There are external 3rd party tools, but I've never been a fan of them in any language (it just never has felt like a clean solution to me). The more fundamental question is what are you actually trying to do with this, as there may be a cleaner and more elegant solution.
I should have been more clear; you know you're in trouble when you can't clearly define the problem (or question) ... which to be honest, is probably winder in scope that simple 'what is a substitute Java mechanic for #define).
Previously, I had a class, called Vars. With members for each conditional requirement for Java code to be compiled (or executed). For example, Vars.condition1 or Vars.condition2
This solution just seemed really messy and ugly. I've only been using Java for maybe a year (been using C and C++ much longer), so am quite unfamiliar with good programming practices available in Java.
Someone mentioned the use of the keyword 'final'. I'm guessing that's used to show a value won't be changed; like a const? Maybe?
So anyway, the conditional compilation issue is just one of the problems I'm having. But there's more....
I'm having to maintain an Android project with multiple targets, using different store IAP code, and also Google Play Services or Amazon Game Circle or whatever, for leaderboards. How best to handle that? At the moment, I'm thinking some kind of class heirachy malarky.
Apologies if my original question was a bit vague.