Computer Applications
If the value of basic=1500, what will be the value of tax after the following statement is executed?
tax = basic > 1200 ? 200 :100;
tax = basic > 1200 ? 200 :100;
Java Operators
ICSE 2019
38 Likes
Answer
Value of tax will be 200. As basic is 1500, the condition of ternary operator ā basic > 1200 is true. 200 is returned as the result of ternary operator and it gets assigned to tax.
Answered By
20 Likes
Related Questions
Evaluate the given expression when the value of a=2 and b=3
b*=a++ - ++b + ++a; System.out.println("a= "+a); System.out.println("b= "+b);
Identify the operator that gets the highest precedence while evaluating the given expression:
a + b % c * d - e
- +
- %
- -
- *
Write the Java expression for the following:
Write a Java program to obtain principal amount, rate of interest and time from user and compute simple interest.