What is multi-catch in Java, and when is it useful?
Multi-catch lets a single catch clause handle several unrelated exception types. You write the alternatives separated by a pipe: catch (IOException | SQLException e). It removes a block of copy-pasted catch clauses that all did the same thing.
The useful case is a group of exceptions that are handled identically. A method that closes a resource and parses a value might fail with any of several unrelated checked exceptions, and the caller wants to log and continue in all of them. Writing three catch clauses with the same body is noise; multi-catch expresses the intent in one line.
Two rules make it work. The alternatives must be unrelated — none may be a subclass of another, because then the subtype would be unreachable and the compiler rejects it. And the caught variable's type is the least upper bound of the alternatives, so with IOException and SQLException you get something assignable to both, in practice Exception. That means you cannot call a method specific to one of them without casting, which is the price of the shorthand.
Multi-catch is not a licence to catch everything. Catching Exception and RuntimeException together is legal but usually wrong, because it swallows the programming errors you wanted to see. The rule of thumb is that multi-catch is for types you genuinely handle the same way, and the more specific the list, the better.