write an example program to show the use of ternary operator
Answers
Answered by
1
Answer:
Example: Java Ternary Operator
class Operator {
public static void main(String[] args) {
Double number = -5.5;
String result;
result = (number > 0.0) ? "positive" : "not positive";
System.out.println(number + " is " + result);
}
}
Similar questions