Java: String.format

(Last Updated On: )

To format a string with parameters use String.format. There are different ways to use it depending on boolean, number, etc.

Format with Boolean

String.format("Boolean: %b", true)

Format with Number

String.format("Number: %n", 32)

Format with String

String.format("String: %s", "Information")