It really isn't very easy to do this. In general, you can do
something like
public class MyClass
{
public static final boolean HAS_CHEEZBURGER=true;
public void someMethod()
{
if( MyClass.HAS_CHEEZBURGER)
{
doCheezburger();
} else
{
noCheezBurger();
}
}
}
The compiler I think will see that HAS_CHEEZBURGER is constant and
can never change, and may optimize away the branch not taken. Perhaps
some more knowledgeable folk could comment on that.
If on the otherhand, you really really think you need to do
preprocessing using eclipse and Java, you can. See the following
link.
http://www.boldinventions.com/index.php?option=com_content&view=article&id=81:javapreprocessorusingeclipse&catid=34:category-electronics-articles&Itemid=53
-Kevin
On Mar 30, 5:57 am, Dilip Dilip <[email protected]> wrote:
> Hi All,
> How to do conditional compilation in JAVA.
>
> something like in C, C++ :
>
> #ifdef TRUE_CONDITION
>
> #else
>
> #endif
>
> Thanks and Regards,
> Dileep
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to
android-developers+unsubscribegooglegroups.com or reply to this email with the
words "REMOVE ME" as the subject.