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

5th Jun 2020, 7:01 AM
sathish kumar
sathish kumar - avatar
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
5th Jun 2020, 7:18 AM
MST
5th Jun 2020, 7:38 AM
Abhay
Abhay - avatar
0
Plzz follow if it helped
5th Jun 2020, 7:21 AM
MST