✏️ Explanatory Question
The finally clause ensures that certain code executes whether or not an exception occurs.
It is used to release resources, close files, or perform cleanup operations.
Example:
try {
FileInputStream file = new FileInputStream("data.txt");
}
catch (IOException e) {
System.out.println("File error occurred!");
}
finally {
System.out.println("Closing file and cleaning up resources.");
}