| Author |
Why doesnt this compile?
|
rohan yadav
Ranch Hand
Joined: Oct 13, 2009
Posts: 156
|
|
Why the compiler is giving compiler error??
This question from ExamLab
|
Sage of The Monstrous Toad of Mount Myoboku
|
 |
Raju Champaklal
Ranch Hand
Joined: Dec 10, 2009
Posts: 521
|
|
|
s1==s2+","+s2 will give false....and then you are comparing a boolean with a string which is illegal
|
scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
|
 |
Rafael Angarita
Ranch Hand
Joined: Jan 09, 2009
Posts: 67
|
|
Yes!...Try enclosing the string comparisons between parenthesis and see what happens!
|
Rafael Angarita.
SCJP 6.
|
 |
Raju Champaklal
Ranch Hand
Joined: Dec 10, 2009
Posts: 521
|
|
this is because + comes higher in the table than == so first the strings are added and then compared....you get a boolean...and then boolean is compared with a string which is illegal?
understood man?
nice question by the way....this helped clear my concept of the table
|
 |
rohan yadav
Ranch Hand
Joined: Oct 13, 2009
Posts: 156
|
|
Understood now:
|
 |
 |
|
|
subject: Why doesnt this compile?
|
|
|