How would I be able to access specific strings with and array list?
List<String> myList = new ArrayList<String>();
myList.Add("Hi");
myList.Add("Pizza");
myList.Add("Can");
So if I did that and then I do:
for (String s : myList)
if (s == "Hi")
system.out.println("Hello"):
It would not print "Hello".
I need the size to change and see if the string exists but I can't seem to get this to work, any ideas?
==
to test non-primitive objects for equality, generally. OverrideObject.equals()
meaningfully and use it. – Victor Sorokin 48 mins agolist.contains("Hi")
can also be used. – Narendra Pathai 45 mins ago