FirstHack 2026 — a 36-hour online hackathon built for first-year students.•₹1,00,000 prize pool•22 Oct – 4 Nov•Open to every branch and every stream•Certificate for every team that submits•3 rounds•FirstHack 2026 — a 36-hour online hackathon built for first-year students.•₹1,00,000 prize pool•22 Oct – 4 Nov•Open to every branch and every stream•Certificate for every team that submits•3 rounds•
Checked vs unchecked, what finally guarantees, and closing files correctly.
12 min read·Lesson 6 of 6·Pro
An exception is a return path for failure
In C, a function that fails returns -1 or NULL and the caller is trusted to check. Nobody checks every time, so failures get ignored and surface later as corrupted data.
Java takes the other route. When something goes wrong, the method throws an exception: normal execution stops, and the JVM walks back up the call stack looking for a handler. Nothing can be silently ignored.
Java
public class Basic {
public static void main(String[] args) {
int[] a = {1, 2, 3};
The rest of this lesson is Pro
The free lessons of Java Fundamentals finish what
they start — read those first if you have not. This one goes further, and it
is part of the paid half.
A pass opens the paid lessons of every course, the mock test papers
and the company-wise series. It ends on its own date; nothing renews by itself.