The 'Next button is disabled and not able to move to the next lesson


#1

Hi All,
Got stuck in Ternary.
The 'Next button is disabled and not able to move to the next lesson.Though I get the result as expected, I'm getting the following message
Did you set canDrive equal to the result of the ternary expression? You can use the example to help you.

Here is my code
public class Ternary {
public static void main(String[] args) {

	char fuelLevel = 2 ;

char canDrive = (fuelLevel != 3)? 'Y' :'N';

System.out.println(canDrive);

Thanks in Advance !...please help me


Stuck in Ternary Conditional part
#2

First of all, is the next button appearing and it will not let you click on it and pass the lesson?
Or is your code just wrong?


#3

fuelLevel should probably be an integer.

And you were asked to use this ternary expression:

(fuelLevel > 0) ? 'Y' : 'N';

but I see this in your code:

(fuelLevel != 3)? 'Y' :'N';

#4

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