9/11 Ternary Conditional help?!


Hey, I am not too sure what i have done wrong with this code, So I have done the Instructions and I am getting the correct output value of 'Y' .

But I am getting an error message at the bottom of the screen 'Did you set canDrive equal to the result of the ternary expression? You can use the example to help you.' I have used the example and cant really work out what is going wrong... any assistance would be great :slight_smile:

Kindest regards


public class Ternary {
	public static void main(String[] args) {
		int fuelLevel = 3;

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


Help 9/11 ternary conditionals

Hey there, what is the output error? can you post it here?
I think there's something wrong with the site, i'm coding too, but even if the code is correct i get an error and can't go forward.


Hi, Yes think you are right, once I reset the code and wrote the exact same thing again it worked


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