Enter your Sign on user name and password.

Forgot password?
Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of Introduction to Java
  • Discussion

  • Study Guides

  • Download Lecture Slides

  • Table of Contents

  • Related Services

Lecture Comments (7)

1 answer

Last reply by: Professor Quayle
Sun May 18, 2014 10:38 PM

Post by Thuy Nguyen on May 5, 2014

Is there also a .compareTo - Ignore case?

2 answers

Last reply by: M C
Fri Jul 5, 2013 7:22 PM

Post by M C on July 4, 2013

Re: Scenario 1: Use of == operator on 2 Strings objects that were initialized at "development time":

Per your explanation about use of == operator on 2 String objects that were initialized at "run time" (Scenario 2), "the == operator tells you whether the 2 String objects share the same memory location."

Based on this explanation, it seems you are saying that the reason the == operator returned "true" for Scenario 1 is that the s1 and s2 String objects "share the same memory location." Is that what you meant? If so, I do not understand why Java does this. Please provide some explanation.

You really left the "true" outcome of the Scenario 1 == operator hanging, after executing Scenario 2 and then explaining the effect of the == operator.

1 answer

Last reply by: Arshin Jain
Sat May 4, 2013 9:02 PM

Post by John Dixon on May 13, 2012

Video is wonderful and very helpful. I wish though the entire code was available for testing on my end so I could run it at the same time he does. It is helpful to see this as I try to make sense of it all. Thanks plenty.


  • A string consists of zero or more characters
  • A literal string is a sequence of characters within double quotes
  • Use the + or += operator to concatenate (join the contents of) two strings
  • The length method tells you the number of characters in a string
  • Use the equals or compareTo methods (not ==) to compare two strings
  • The substring and indexOf methods are useful for string manipulation


Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

  • Intro 0:00
  • Roadmap 0:25
  • Literal Strings 1:27
    • Class: Strings
    • String Is Immutable
    • Example
    • Literal Strings
    • String Variables
    • Example: String Variable
  • String Concatenation 7:03
    • Example
    • Example: String Concatenation
  • String Concatenation 10:00
    • Assignment Operator
    • Example
    • Example: String Concatenation
  • String Length 13:05
    • Example: String Length
  • String Comparison 16:04
    • Equals Method
    • Example: String Comparison
  • String Comparison 21:40
    • String.Equals: Case-Sensitive
    • Equals Ignore Case: Case-Insensitive
    • Example: Case-Sensitive and Case-Insensitive Comparison
  • String Comparison 25:38
    • Compare To (String.compareTo)
    • Example
    • Example: Sting Comparison Using the compareTo Method
  • Taking a Subset of a String 30:34
    • Substring Method
    • 2 Versions
    • 1st Version: Takes One Parameter
    • 2nd Version: Takes Two Parameters
    • Example: Substring
  • Searching Within a String 36:04
    • indexOf Method
    • 1st Version: Takes One Parameter
    • 2nd Version: Takes Two Parameters
  • Searching Within a String 38:36
    • lastIndexOf Method
    • 1st Version: Takes One Parameter
    • 2nd Version: Takes Two Parameters
  • Summary 40:43