Hello, My name is Jamel and I don’t understand the instructions on #9 in the Learn Java Module. The instructions say:
Set the canDrive variable equal to the ternary expression: (fuelLevel > 0) ? ‘Y’ : ‘N’;
I wrote the following code:
public class Ternary {
public static void main(String args) {
int fuelLevel = 3;
char canDrive = (fuelLevel > 0)?'Y':'N';
System.out.println(canDrive);
}
}
I get the error;
Did you set canDrive
equal to the result of the ternary expression? You can use the example to help you.
What is the program asking me to do? I don’t get it.