This article is about the military unit. There is also an article on geological formations or stratum.
A formation is a grouping of military units such as a Brigade, Division, Corps, Army or Army group. Technically, formations and units are different entities (a unit being a homogeneous organisation, such as a battalion, instead of a collection of separate organisations), but the terms are often used interchangeably.
When you call format(s), where s is the format-string, it constructs an object, which parses the format string and look for all directives in it and prepares internal structures for the next step.
All in all, the format class translates a format-string (with eventually printf-like directives) into operations on an internal stream, and finally returns the result of the formatting, as a string, or directly into an output stream.
When format detects that one of these rules is not satisfied, it raises a corresponding exception, so that the mistakes don't go unnoticed and unhandled.