There's no "official" pre-processor for Java, and there is no third-party one that's widely used.
But nothing stops you from using any pre-processor you want on your code, if you're willing to live with the handicap that IDEs and many other tools won't handle it correctly.
That being said, you don't usually need it in Java either. You'd rather provide multiple implementations of a common interface (or classes extending a common base class) and choose between them at runtime.
There is, however a limited form of conditional compilation by using compile-time constant boolean flags:
static final DEBUG = false;
public void frobnicate() {
if (DEBUG) {
doExpensiveFrobnicationDebugOperation();
}
doActualFrobnication();
}
This code will result in the expensive method call not being compiled into the bytecode of the resulting .class
file.