Cant find the solution

< Set the canDrive variable equal to the ternary expression: (fuelLevel > 0) ? ‘Y’ : ‘N’; >

...

public class Ternary {
public static void main(String args) {

    int fuelLevel = 3;

    char canDrive = (fuelLevel > 0) ? 'W' : 'L';
    System.out.println(canDrive);

}

}

<do not remove the three backticks above>

instruction:

Set the canDrive variable equal to the ternary expression: (fuelLevel > 0) ? ‘Y’ : ‘N’;

so your code should be like

char canDrive = (fuelLevel > 0) ? ‘Y’ : ‘N’;

use Y and N

Doesnt work that way

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.