Why does this code print Index = 0 for b and s ?
import java.util.ArrayList; public class Arr { public static void main(String[] args) { ArrayList<String> myList = new ArrayList<>(); String s = new String(); myList.add(s); String b = new String(); myList.add(b); int idx = myList.indexOf(b); System.out.println("Index b=" + idx); int idx2 = myList.indexOf(s); System.out.println("Index s=" + idx2); } }