+ 6
it is possible in java ternary operation?
7 Answers
+ 15
Gutch From Ph
//its the same as if,else statments
int x = 100;
System.out.print(x>50?"yes":"no");
// same as
if(x>50){
System.out.print("yes");}
else{System.out.print("no");}
+ 12
if its possible with if and else statements then its possible with ternery i made this using ternary
https://code.sololearn.com/cuowj1Lgng4q/?ref=app
+ 7
ty brođ
+ 6
Thanks guys
because my first ternary in java does'nt work đ
+ 3
Yes, it's possible. You can see some examples here https://www.tutorialspoint.com/Java-Ternary-Operator-Examples
+ 2
When if and else works. Ternary works too provided you have not violated the syntax
+ 1
yes like c and c++ it is possible... just try it out