Computer Applications
The output of a++ will be 1, if int a = -1.
Java Operators
5 Likes
Answer
False
Reason — If int a = -1;, then a++ means the current value of a is used first, and then it is increased by 1. So, the output of a++ will be -1, not 1. This is because ++ is a post-increment operator, which increases the value after it is used.
Answered By
2 Likes
Related Questions
Read the following text and choose the correct answer:
Ternary operator is the only conditional operator that takes three operands. It is a one liner replacement of if-else statement.
Which of the following statements is not true for a ternary operator ?
- It is also called a conditional operator.
- It is a replacement of if-else statement.
- The statement describes in one line only.
- It makes the program lengthy, if applied in Java programming.
The precedence of operators in Java follows BODMAS.
The relational operators always result in terms of 'True' or 'False'.
Given: int m=5; m*=5 then the value stored in m results in 55.