About 89,400 results
Open links in new tab
  1. In Java, String is an immutable class used to store and manipulate text. It provides a wide range of built-in methods for searching, comparing, modifying, and transforming string data efficiently.

    Example:

    public class StringOps {
    public static void main(String[] args) {
    String str = "Hello, World!";

    // Length of string
    System.out.println("Length: " + str.length());

    // Character at index
    System.out.println("Char at 7: " + str.charAt(7));

    // Substring
    System.out.println("Substring(7): " + str.substring(7));

    // Concatenation
    System.out.println("Concat: " + str.concat(" Java"));

    // Search
    System.out.println("Index of 'World': " + str.indexOf("World"));

    // Replace
    System.out.println("Replace l->x: " + str.replace('l', 'x'));

    // Case conversion
    System.out.println("Uppercase: " + str.toUpperCase());

    // Trim spaces
    String spaced = " Trim me ";
    System.out.println("Trimmed: '" + spaced.trim() + "'");

    // Check equality ignoring case
    System.out.println("EqualsIgnoreCase: " + str.equalsIgnoreCase("hello, world!"));
    }
    }
    Copied!
    Feedback
  2. Java String Reference - W3Schools

    40 rows · All String Methods The String class has a set of built-in methods that you can use on strings.

  3. People also ask
  4. Common String Operations in Java - Baeldung

    Jan 8, 2024 · String-based values and operations are quite common in everyday …

  5. Java String (With Examples) - Programiz

    • Java provides various string methods to perform different operations on strings. We will look into some of the commonly used string operations.
    See more on programiz.com
  6. Java String Operations: A Comprehensive Guide - javaspring.net

    Nov 12, 2025 · Understanding how to perform various operations on strings is crucial for Java developers. This blog will delve into the fundamental concepts, usage methods, common practices, …

  7. String in Java: A Comprehensive Guide with All Methods

    Mar 26, 2025 · String is one of the most widely used classes in Java. It represents a sequence of characters and is...

  8. Java String Manipulation with EXAMPLE - Guru99

    Nov 26, 2024 · As a Java programmer, one of your main tools for storing and processing language is going to be the String class. Now, let’s get to some …

  9. Java String Class - Complete Tutorial with Examples - ZetCode

    Apr 13, 2025 · In this article, we've covered the essential methods of the Java String class with practical examples. Understanding these methods is crucial for effective string manipulation in Java …

  10. Java Strings - W3Schools

    A String in Java is actually an object, which means it contains methods that can perform certain operations on strings. For example, you can find the length of a …

  11. Java Strings - GeeksforGeeks

    5 days ago · In Java, a String is the type of object that can store a sequence of characters enclosed by double quotes and every character is stored in 16 bits, …