Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+19 votes

cityName == “Rock Island” will compare the characters stored in the String variable cityName with the characters in the String literal “Rock Island”.

asked in CSC211_Winter2018 by (1 point)

2 Answers

+15 votes
Best answer

False, Dr. Mueller covered this in class the other day. The == compares the location that the string is stored in memory so it would be comparing cityName to the new string "Rock Island" that is stored in two different locations of Java.

answered by (1 point)
selected by

Thank you!

+11 votes

False because you can't put == for a string instead cityName.equals("Rock Island")

answered by (1 point)