Exception Handling and Java I/O Flashcards
6 cards from real SCJP practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Exception Handling and Java I/O flashcards as text
Which of the following is a checked exception in Java?
Answer: IOException
`IOException` is a checked exception that must be declared with `throws` or handled with a `try-catch` block.
What is the purpose of the `finally` block in Java exception handling?
Answer: It always executes after try/catch, regardless of outcome
The `finally` block executes unconditionally after the `try` and any matching `catch` blocks, making it ideal for cleanup code.
Which keyword is used to manually throw an exception in Java?
Answer: throw
The `throw` keyword is used to explicitly throw an exception object within a method body.
What happens if an exception is thrown inside a `finally` block?
Answer: It replaces any exception from the try/catch block
An exception thrown inside a `finally` block propagates upward and discards any exception that was in progress from the `try` block.
Which class is the parent of all errors and exceptions in Java?
Answer: Throwable
`Throwable` is the root of the Java exception hierarchy — both `Error` and `Exception` extend it.
In Java I/O, which class is used for reading characters from a file efficiently with buffering?
Answer: BufferedReader
`BufferedReader` wraps a `Reader` (like `FileReader`) to provide buffered character reading and the convenient `readLine()` method.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy