String str1 = "hello"; String str2 = "hello"; assertSame(str1, str2); // passes as str1 and str2 reference the same "hello" object in memory
String str1 = "hello"; String str2 = new String("hello"); // creates a new object in memory assertNotSame(str1, str2); // passes as str1 and str2 reference different objects in memoryPackage library: org.testng.AssertJUnit from the TestNG testing framework.