My Doubt is why the string " 3 " ," 4 " in line 1 are not printing and also totally we have 6 boolean tests but why I am getting only 5 boolean literals.
Ya I replaced . Now I am able to get the Strings " 3" and " 4 " in the output. But still i didn't get the logic in the brackets(). What happens if there is no bracket ???
" 3 " + (s2 == s3) + " 4 " + s2 this part of the statement results to
"sfalse4java"----------- which is a string.
Now you are comparing this... it would be like this
("sfalse4java")==s4
SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
this s operator precedence..
== operator has less priority than +
and the expressions are evaluated from left to right..
so in Line1 is evaluated as false.
the expression is similar to :
(" 3 " + (s1==s3) + " 4 "+ s2) == s4
the result of this expression is false..
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.