Test code:
int[] test = {0, 1, 2, 3};
System.out.println("test1[3] ++== 0 is " + (test[3] ++== 0));
Result:
test1[3] ++== 0 is false
So it must be some sort of logical operator but I have not been able to find any documentation. Searching the Internet yielded no reference.
Please help? Thanks in advance.
The way the text is presented looks like it would be a special case ++==
, but in fact you should read it as follows:
test[3]++ == 0
Basically, the result of test[3]++
will be compared (i.e ==
) with 0
.
And this basically reads as (test[3]=3) == 0
, which is false.
The ++
is a postfix operator which is shortcut for value = value + 1
.
The ==
is a comparison between two values.
The text is just badly formatted, that's all.
++
and ==
are two independent operators. ++
is post-incrementing the value of test[3]
, then that is being compared to 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With