+ 2

String s1 == string s2 produce the output as false while we assuming the same string in both s1 and s2..

23rd Sep 2018, 8:13 AM
M.MANIVANNAN
M.MANIVANNAN - avatar
3 Respuestas
+ 1
ex : string s1="manivannan"; string s2=new string("mani"+"vannan"); system.out.println(s1==s2); op:false why.??
23rd Sep 2018, 8:37 AM
M.MANIVANNAN
M.MANIVANNAN - avatar
+ 1
Because, both of them have different memory address. As == will check the given variable's address rather than its content.
25th Sep 2018, 6:09 AM
Codeie
Codeie - avatar