Android Application Development Tutorial - 28 - Comparing Strings with else if

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
16,077
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 19, 2011

Check out the full series at http://www.thenewboston.com/

Here is a link to the mybringback YouTube Channel. Go and subscribe now!

http://www.youtube.com/user/mybringback

Also, the mybringback official website:

http://mybringback.com/

  • likes, 1 dislikes

Link to this comment:

Share to:

Top Comments

  • I really like these tutorials...for the most part.

  • @xXxDiukexXx you cannot use == to compare the contents of strings or any other objects because == with objects is checking to see if they have the same location in memory instead of checking to see if the strings contain the same word. The .contentEquals() method compares the actual strings instead of the memory location

see all

All Comments (37)

Sign In or Sign Up now to post a comment!
  • @vilham437

    but if strings got the same contain, they just take the same place in memory

    example, if u got 20 strings and "lol" in them, it just will create one String object

    so you can check contain of the strings

  • @Mr1159pm I'be been coding for years and your comment made me understand primitives vs objects from a new perspective.

  • why can't you use equals() instead of contentEquals()? What's the difference... for the most part?

  • Excelent Tutorial, ALL.. 

  • this is a string, for the most part.....HAHAHAHA...  love it.

  • @joannis11 Wrong. That will simply compare if they are initialized in the same way. Since String is a class and not a variable type, per se, you have to use a method to compare them.

  • Dude, we know Java already.

  • @vilham437 Or .equals()

  • "Hey, if you need anyone to set up some buttons in Java .. I'm you're man!"

    that's gonna be my new pickup line for sure.

  • @vilham437 This is true only for java. In c# or Python you can use == to compare Strings

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more