Inverse of Fractions using Java
<p>Fraction switches numerator and denominator.
inverse of 2/1 is 1/2</p>

<p>what i got so far:</p>

<pre><code>public void inverse(){
    numerator = denominator;
    denominator= numerator;
}
</code></pre>

<p>this makes the inverse of 2/1 equal 2/2.</p>

<p>I know this is happens because num = den (so num=2) and den = num (so den=2).</p>

<p>How would i switch  to get num=2 and den =1?</p>