What is a String?
A string is a sequence of characters — like letters, numbers, or symbols — grouped together as text. In programming, strings are used to store and work with text.
Java string is a sequence of characters that exists 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.
A string is sequence of characters. A class is a user-defined template for creating an object. A string class is a user-defined template for creating and manipulating string objects, which are sequences of characters.
Example
String name = "Ranjith";
*"Ranjit" is a string.
* It is made of characters: R, a, n, j, i, t.
Important Points:
*Strings are enclosed in double quotes (" ").
*They can include letters, digits, and symbols.
Why do we use String in Java?
* In Java, we use String to store and manipulate text — like names, sentences, symbols, or any characters.
* It is one of the most important and commonly used data types in Java.
Reffer;
https://www.theserverside.com/definition/Java-string
Top comments (0)