Just a guess, since I don't know a lot about Java (yet), but strings are objects, so if you were to use ==, you would be comparing the objects themselves instead of the contents of the objects.
On Jun 13, 11:25 am, javanew2 <[email protected]> wrote: > Hi all, > > Below is some code from this lab. In the For Loop below the following > question is asked: > > // * The equals(..) is a method of String class. Think about why you > // cannot use "names[i] == searchName" as comparison logic here. > > Is the correct answer... "Becuase searchName is an instance of the > String class and to access it's value you must use the String class > method "equals"? --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
