Can I place a ternary operator inside another ternary in java?

Asked

Viewed 33 times

0

I can place a ternary operator inside another ternary in java?

(num1 == num2)? System.out.println("Type different numbers! " ):larger = (num1 > num2)? num1:num2;

  • yes you can, look at the content of the duplicate answer p more details

  • Power I believe you can, but avoid. At the moment you will understand but then it will get hard to read.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.