Java: Ternary conditional statement

Last updated on:

public class Ternary {
public static void main(String[] args) {
int fuelLevel = 3;
char canDrive = (fuelLevel > 0) ? 'Y':'N';
System.out.println(canDrive);
}
}
</pre>

View Comments

Leave a Comment

Use markdown or basic HTML and be nice.