In a Java 7 multicatch block such as the following:
try {
// code that throws exception
} catch (CharacterCodingException | UnknownServiceException ex) {
// handle exception
}
what is the compile-time type of ex
? Is it the most derived class that both exception types have in common? In this example that would be an IOException
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…