Help 9/11 ternary conditionals


#1

Continuing the discussion from 9/11 Ternary Conditional help?!:

public class Ternary {
public static void main(String[] args) {

	int fuelLevel = 3;

	char canDrive = (fuelLevel > 0)? 'Y':'N';
	System.out.println(canDrive);

}

}

https://www.codecademy.com/courses/learn-java/lessons/conditionals-control-flow/exercises/ternary-conditional?action=lesson_resume

		char canDrive = (fuellevel > 0)? 'y' : 'n';
		                         ^
  symbol:   variable fuellevel
  location: class Ternary
1 error

<do not remove the three backticks below>

not sure what is wrong i dont think it is actually storing fuellevel but i have just started and may be mistaken.


#2

Why do you say that it is wrong? What is the problem?

Looks like you've posted about half of an error message. Have you read it? Was there trouble understanding what it's saying, or addressing the problem it presented? If so, then that's probably what you should be asking about instead (and include the other half of the thing you're asking about)


#3

that was all that was in the output window


#4

It's not, and you're only responding to about 20% of what I said :confused: I give up. Please note that the easier you make it to reply, the more likely it is that you will get what you want.


#5

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