Java for Testers - Part 95 - Difference between == and equals() method

preview_player
Показать описание
In this video, I have explained and practically demonstrated the difference between == operator, and equals() method in Java.
Рекомендации по теме
Комментарии
Автор

hi Arun,
String a = "Satya";

String b = "Satya";
String c = a;
System.out.println(a==b);

System.out.println(a==c);

if we use new keyword both are FALSE and TRUE,
if we use shortcut method both are TRUE.
Please Advise...!
Cheers🍻☺

satyahari
Автор

Hi Arun what about
String a = "aa";
String b = "aa";
System.out.println(a == b); // true

so we can describe this way also instead of new String("aa")

testingrule