Skip to content

Instantly share code, notes, and snippets.

@learnit-codeit
Created February 23, 2021 09:50
Show Gist options
  • Save learnit-codeit/8773d044ac20a29ccf3a88f3bb961234 to your computer and use it in GitHub Desktop.
Save learnit-codeit/8773d044ac20a29ccf3a88f3bb961234 to your computer and use it in GitHub Desktop.
String str1 = "Hello";
String str2 = "Hello";
StringBuffer buffer1 = new StringBuffer("hello");
StringBuffer buffer2 = new StringBuffer("hello");
System.out.println(str1.equals(str2));//this return true
System.out.println(buffer1.equals(buffer2));//this return false. Because StringBuffer not override the equals method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment