Why can't I use the ternary ? operator to select between two function calls?
<p>I was recently programming and ran into an issue using the ? : operand. Here's my code.</p>

<pre><code>    Random rand = new Random();
    for(int x = 0; x &lt; 3; x++) {
        rand.nextInt(1) == 0 ? vertShip(board) : horizShip(board);
    }
</code></pre>

<p>My compiler throws me an error stating that the left hand side of the line (rand.nextInt(1) == 0 ) must be a variable. I've tried variants such as </p>

<pre><code>    Random rand = new Random();
    int a = rand.nextInt(1);
    for(int x = 0; x &lt; 3; x++) {
        a == 0 ? vertShip(board) : horizShip(board);
    }
</code></pre>

<p>or if statements in the left hand side but they don't fix the problem. Would anyone be able to help me?</p>
