+ 1

What is the use of '?' sign in java??

25th Apr 2017, 12:36 PM
Nadir wadsariya
Nadir wadsariya - avatar
4 Réponses
+ 25
Ternary Operator?
25th Apr 2017, 12:39 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 7
Max=(a>b)?a:b; These are known as ternary operators in java.They are basically like a short form of your conditional statements. like if(a>b) { max =a; else max=b; }
25th Apr 2017, 12:54 PM
Manideep
Manideep - avatar
25th Apr 2017, 12:49 PM
Yusuf Malikul Mulki
Yusuf Malikul Mulki - avatar
+ 1
in a challange i got this question and i got completly confused.. question goes this way x = x==4?x;2:x%2;
25th Apr 2017, 12:47 PM
Nadir wadsariya
Nadir wadsariya - avatar