+ 1

using java what is the usage of question mark ?

what does the question mark do when added to the code .

1st May 2017, 1:12 AM
Ahmed Ali
Ahmed Ali - avatar
2 ответов
+ 3
You should ask a more descriptive question. But what comes to mind are ternary operations. In C# (and perhaps other languages) you can also use it to declare nullable types. eg. int? to declare a nullable integer. This can come in handy if returning null as a value from a database.
1st May 2017, 1:50 AM
Mike
Mike - avatar
+ 2
(Please make more descriptive question) The best I can guess is "ternary function" fruit = input=="apple"?apple:"not apple";
1st May 2017, 1:20 AM
Calviղ
Calviղ - avatar