The statements in the ternary operator need to be non-void. They need to return something.
System.out.println(direction == 0 ? 'L' : 'R');
More Related Contents:
- Write 1 line If statement using ternary operator in JAVa
- What is the Java ?: operator called and what does it do?
- What is a Question Mark “?” and Colon “:” Operator Used for? [duplicate]
- Ternary Operator – JAVA [duplicate]
- Ternary Operators Java
- Why does the ternary operator unexpectedly cast integers?
- Java Ternary without Assignment
- Unexpected type resulting from the ternary operator
- Why doesn’t this method work? Java ternary operator
- “Wrong” return type when using if vs. ternary opertator in Java
- Why ternary operation gives nullpointer while its ifelse counterpart doesn’t? [duplicate]
- Why do we really need Comparator in Java? [closed]
- How to use class instead of interface for lambda param
- Java 8 Streams hashmap
- Java inner class and static nested class
- What is the native keyword in Java for?
- How to delete firebase data after “n” days
- Progress Bar Java
- Rethrowing an Exception: Why does the method compile without a throws clause?
- NullPointerException on Button.findViewById()
- Jersey + Jackson JSON date format serialization – how to change the format or use custom JacksonJsonProvider
- Disable the log from specific class/jar via logback.xml
- Center JDialog over parent
- Generating all permutations of a certain length
- How to fix the ”module java.base does not “opens java.io” to unnamed module ” error in Android Studio?
- how to create a remote session EJB from a client
- Which “if” construct is faster – statement or ternary operator?
- How do you get a reference to the enclosing class from an anonymous inner class in Java? [duplicate]
- How to run all JUnit tests in a category/suite with Ant?
- What is the difference between @ApplicationScoped and @Singleton scopes in CDI?