Is it possible to combine more than one condition in the tire industry? Example:
boolean existe = pessoa tem 23 ou pessoa tem 22 ? true : false ;
I'm trying but I can not.
Is it possible to combine more than one condition in the tire industry? Example:
boolean existe = pessoa tem 23 ou pessoa tem 22 ? true : false ;
I'm trying but I can not.
Would that be?
boolean existe = (idade == 22 || idade == 23);
Yes, it is possible:
If you want to necessarily use the ternary operator (as asked):
boolean existe = pessoa.getIdade() == 23? true : pessoa.getIdade() == 22? true : false ;
But in this example you would not need to use this operator:
boolean existe = pessoa.getIdade() == 23 || pessoa.getIdade() == 22;