Java Basics: Strings
Programming Fundamentals in Java
JAVA CLASSES ON STRINGS
Class COMPARATIVE DESCRIPTION
String immutable
StringBuilder mutable. Not threadsafe (not
synchronized)
StringBuffer mutable. Threadsafe.
STRING FORMAT SPECIFIERS
SPECIFIER DESCRIPTION
%d Integer
%s String
%x Hex string of the value
%f Float (to specify 2 decimal places
“%.2f”)
ESCAPE SEQUENCES
SPECIFIER DESCRIPTION
\n New line
\t Tab
\\ Backlash character
\’ Single quote
\’’ Double quote