Cant find the solution


#1

< 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);

}

}

`


#2

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


#3

Doesnt work that way


#5

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