Java Basic Tutorial
Java Advance Tutorial
In Java, a String
is a sequence of characters. It is one of the most commonly used data types, and Java provides the String
class to work with strings. Strings in Java are immutable, meaning their value cannot be changed once created.
You can create a string in two main ways:
new
KeywordTry it yourself
Strings are immutable in Java. When you modify a string, a new string object is created instead of modifying the original.
If you need to modify strings frequently, use StringBuilder
or StringBuffer
for better performance as they are mutable.