Can we have multiple catch blocks for a single try block?

Beginner

Answer

Yes, multiple catch blocks are allowed. They are evaluated in order, so more specific exceptions should come before general ones.

try {
    // risky code
} catch (FileNotFoundException e) {
    // handle file not found
} catch (IOException e) {
    // handle other IO exceptions
} catch (Exception e) {
    // handle any other exception
}