0
How to compare two strings (words) are equal in java.eg 1: 1)Kumar and 2)hello eg2: 1)project 2) project
Answer the code to help me to solve
5 ответов
+ 2
This the snippet bro
String s1="Kumar";
String s2="hello";
boolean b=s1.equals(s2);
Or you could also use
boolean b=s1.equals("hello");
And the reason that you cant compare string with == is that string are object and not primitive data type
+ 2
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 ty for correcting me
0
Plzz follow if it helped