Computer Science, asked by laljee802116, 6 months ago

write an example program to show the use of ternary operator​

Answers

Answered by Rajakhavin
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