When using this ternary operator shorthand format?
When the operator if else, when there is a specific result can be simplified written ternary operator.
Otherwise, if the program in order to output to the console, then do not use if else shorthand. For example:
int = A. 3;
IF (A> 2)
{
System.out.println ( "Yes");
}
the else
{
System.out.println ( "NO");
}