The String class has a format method that behaves exactly like the printf method.