+ 9
Can anyone please explain me the first operand of AND operator in the following code?
solo s1=new solo (); solo s2=new solo (); String str1="abcd", str2="abcd"; if(s1.equals (s1)&&str1.equals (str2)){ s.o.p ("ab"); else s.o.p ("cd");
8 Answers
0
mine is (Hari P Sharma)
+ 8
You created two new instances of your class 'solo' namely s1 and s2.
You have two String literals str1 and str2 which are equal (as "abcd").
* Then, you check if instance s1 is equal to s1 (always true) and str1 is equal to str2, the result will be true of course. Therefore, it prints ab as the result.
You made a typo there as well, you should close the 'if' code block before entering into 'else'.
+ 7
thank you so much dev
+ 2
Wee hee
+ 1
its the same dear
+ 1
wait ill send you request
0
hey Jigme sis.. can i get ur fb name???
0
school gacha mo ashim??? fb nga