As you may recall, a String, which is widely used in Java, is an object that represents a sequence of characters. It is a great way to store information.

Because character strings are so vital to programming, Java dedicated an entire class to them. This is great news for us because the String class has a lot of useful methods to help us perform operations on Strings and data manipulation. We don’t have to import anything to use the String class because it’s part of the java.lang package which is available by default.

In this lesson, we will go over several String methods:

  • length()
  • concat()
  • equals()
  • indexOf()
  • charAt()
  • substring()
  • toUpperCase() / toLowerCase()

Let’s get started!



Run the code in the code editor.

There are three string methods used in this program. We’ll learn about them later, but can you guess what some of them do?

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?