Y c&d strings are mismatch.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Y c&d strings are mismatch..

public class Program { public static void main(String[] args) { String a="a"; String b="b"; String c=a+b; System.out.println(c); String d="ab"; if (c==d) System.out.println("1"); else System.out.println("0"); } }

25th Jun 2017, 4:17 AM
Anusuya
Anusuya - avatar
4 Answers
0
they are both same. could you plz check your code again? this code gave me 1 as result: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string a="a"; string b="b"; string c="ab"; string d=a+b; if(c==d) { console.writeline("1"); } else { console.writeline("0"); } } } }
25th Jun 2017, 4:45 AM
Farshad Hosseini nezhad
Farshad Hosseini nezhad - avatar
0
the ans 0 is crct but how it will be came ???
25th Jun 2017, 4:48 AM
Anusuya
Anusuya - avatar
0
why zero?
25th Jun 2017, 7:27 AM
Farshad Hosseini nezhad
Farshad Hosseini nezhad - avatar
0
I don't know...that's y I ask this question
26th Jun 2017, 1:18 PM
Anusuya
Anusuya - avatar