Computer Applications
Evaluate the Java expression:
x = a * b % (++c) + (++a) + (--b);
if a = 7, b = 8, c = 2
Java Operators
5 Likes
Answer
x = a * b % (++c) + (++a) + (--b)
x = 7 * 8 % (++c) + (++a) + (--b)
x = 7 * 8 % 3 + 8 + 7 (c becomes 3, a becomes 8, b becomes 7)
x = 56 % 3 + 8 + 7
x = 2 + 8 + 7
x = 17
Answered By
2 Likes
Related Questions
In constructor overloading, all constructors should have the the same name as of the class but with a different set of …………… .
- Access specifiers
- Classes
- Return type
- Parameters
Rewrite the following program segment using a for loop.
int a = 5, b = 10; while (b > 0) { b -= 2; } System.out.println(a * b);Write the Java expression to find the sum of cube root of x and the absolute value of y.
Users must be above 10 years to open a self-operated bank account. Write this logic using a ternary operator and store the result (the eligibility message) in a String variable named idStatus and print it.