title: How to manage multiple versions of same class file for different SDK targets?
body: <p>This is for an Android application but I'm broadening the question to Java as I don't know how this is usually implemented.</p>
  
  <p>Assuming you have a project that targets a specific SDK version. A new release of the SDK is backward incompatible and requires changing three lines in one class.</p>
  
  <p>How is this managed in Java without duplicating any code(or by duplicating the least amount)?
  I don't want to create two projects for only 3 lines that are different.</p>
  
  <p>What I'm trying to achieve in the end is a single executable that'll work for both versions. In C/C++, you'd have a <code>#define</code> based on the version. How do I achieve the same thing in Java?</p>
  
  <p><strong>Edit</strong>: after reading the comments about the #define, I realized there were two issues I was merging into one:</p>
  
  <ul>
  <li>So first issue is, how do I not
  duplicate code ? What construct is there that is the equivalent of a
  <code>#define</code> in C.</li>
  <li>The second one is: is    it possible
  to bundle everything in    the same
  executable? (this is less of    a
  concern as the first one).</li>
  </ul>