Skip to content
Advertisement

Tag: ternary

Ternary Operators Java

Is there a way to implement this in a ternary operation. I’m very new to that ternary stuff, maybe you could guide me. This one doesn’t seem to work. Answer In this case, you don’t even need a ternary operator: Or, cleaner: Your version: is semantically incorrect: ternary operator should represent alternative assignments, it’s not a full replacement for if

Advertisement