In Java, a String is a built-in object that stores a sequence of characters.
Strings in Java are immutable. Any operation on a string returns a new object.
You can join strings using the + operator:
.length() – returns number of characters.toUpperCase(), .toLowerCase().indexOf() – returns index of first match.equals() – compares content.contains() – checks if substring is presentUse escape sequences to include special characters inside strings:
\\n – new line\\t – tab\\\" – double quote\\\\ – backslashUse equals() instead of == to compare string values:
What will this print?
A. true falseB. false trueC. true trueHint: Java interned strings with literals.
Ask the AI if you need help understanding or want to dive deeper in any topic