Stuck in Ternary Conditional part

Okay so I cannot understand this part no matter how many times I read it.

Here is the lesson : https://www.codecademy.com/en/courses/learn-java/lessons/conditionals-control-flow/exercises/ternary-conditional?action=resume

This is the error -

Ternary.java:6: error: illegal start of expression
char canDrive = (fueLevel = = 3) ? ‘Y’ : ‘N’;
^
1 error


My code - 

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

		char canDrive = (fueLevel = = 3) ? 'Y' : 'N';
		System.out.println(canDrive);

	}
}
                                                  Thanks In Advance!

HI this part

(fueLevel = = 3) ? 'Y' : 'N'

remove the space between the = =
then you wrote

fueLevel

instead of

fuelLevel

Ohhh that’s why…
I’m an idiot.
Any way thanks a lot!
It was giving me a headache :3

1 Like

A post was split to a new topic: The 'Next button is disabled and not able to move to the next lesson