-
Notifications
You must be signed in to change notification settings - Fork 0
String Manipulation
Keyhan Hadjari edited this page Sep 13, 2016
·
4 revisions
String class is imutable.
System.out.println("A" + " B"); // "A B"
System.out.println(2 + "A" + "B"); // "2AB"
System.out.println(2 + 5 + "AB"); // "7AB"
String a = "A";
a += "B"; // "AB"
a += 33; // "AB33"
a += true; // "AB33true"The length field returns length of the string.
Returns the character at the given index.
StringBuilder class is mutable and not threadsafe