Definition

Java string

Contributor(s): Matthew Haughn

A Java string is a sequence of characters that exist as an object of the class java.lang. Java strings are created and manipulated through the string class. Once created, a string is immutable -- its value cannot be changed.

Methods of class String enable:

  • Examining individual characters in the string.
  • Comparing strings.
  • Searching strings.
  • Copying strings with characters converted from upper to lower case or vice versa.

Strings can be created simply. For example:

String greeting = "Hello world!";

"Hello world!" in that example is a string literal, defined by the double quotes, which means that the compiler will create an object with that value.

See a tutorial on creating and using strings in Java:

This was last updated in July 2016

Continue Reading About Java string

Dig Deeper on Java EE development and enterprise Java platforms

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

File Extensions and File Formats

Powered by:

SearchCloudApplications

SearchSoftwareQuality

SearchFinancialApplications

SearchSAP

SearchManufacturingERP

Close