View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All
View All

Introduction to Exception Hierarchy in Java: A Comprehensive Guide

By Pavan Vadapalli

Updated on May 27, 2025 | 21 min read | 18.71K+ views

Share:

Did you know? Unlike C's traditional error-prone return codes, Java takes a proactive stance! It forces you to handle potential errors by enclosing risky code in try-catch blocks or explicitly declaring them with throws. This enforced structure eliminates silent failures and makes error management an integral part of your Java program's logic.

The exception handling hierarchy in Java is key to building robust applications. It lets you pinpoint issues with precision, enabling targeted recovery instead of abrupt crashes. This structured approach improves code clarity and maintainability, ultimately enhancing the user experience by providing graceful error handling and preventing silent failures.

By implementing effective exception handling, developers empower their applications to recover from errors gracefully, log issues for debugging, and continue operating smoothly, ultimately contributing to the software's stability and resilience.

Ready to master Java exception handling and other critical software development skills? Explore Online Software Development Courses from leading universities and take your career to new heights. Gain the expertise you need to kickstart your journey as a full-stack engineer. 

Understanding Exception Hierarchy in Java: An Overview

The exception hierarchy in Java is organized into a tree-like structure where different types of exceptions inherit from more general ones. Unlike older languages that rely on return codes for error signaling, Java's hierarchical approach provides a systematic way to categorize and manage exceptions, forcing a structured response. Understanding this structure is crucial because it dictates how exceptions are caught and handled.

Exception Hierarchy Explained

The base class for the exception hierarchy in Java and errors is Throwable. It has two main branches:

  • Exception: This branch represents conditions that a program should catch and handle. While disruptive, these problems can potentially be recovered from.
  • Error: This branch represents more serious problems that a program typically should not try to handle. These are often related to the Java Virtual Machine (JVM) or the underlying system and are usually unrecoverable.

Understanding this exception hierarchy in Java is essential for effective exception handling because catch blocks are designed to catch specific types of exceptions. 

A more general catch block (e.g., catch (Exception e)) can catch any exception within that branch, while a more specific catch block (e.g., catch (IOException e)) will only catch exceptions of that particular type.

Throwable 
|-- Error 
| |-- VirtualMachineError
 | | |-- OutOfMemoryError
 | | |-- StackOverflowError
 | |-- ... |-- Exception
 | |-- RuntimeException (Unchecked)
 | | |-- NullPointerException
 | | |-- IllegalArgumentException
 | | |-- ... | |-- Checked Exception
 | | |-- IOException
 | | |-- SQLException | | |-- ...

Mastering Java exception handling is just the beginning of your journey to building resilient software! To deepen your expertise in software development and emerging AI technologies, consider advancing your skills with these comprehensive programs:

Java Errors vs. Exceptions: Understanding the Distinction

While both Errors and Exceptions inherit from Throwable, they represent fundamentally different situations in the exception handling hierarchy in Jav

1. Java Errors

Errors represent severe problems that the program cannot usually recover from. They often indicate a critical issue with the JVM or the operating system. Programs should not typically attempt to catch or handle errors. Instead, they should focus on preventing the conditions that lead to them. Trying to catch an Error in production code is generally futile and can even mask critical system issues.

Examples of Errors include:

  • OutOfMemoryError: Indicates that the JVM has run out of memory and cannot allocate more.
  • StackOverflowError: Indicates that the call stack has overflowed, usually due to excessive recursion.
  • VirtualMachineError: A more general error indicating that the JVM has encountered a problem. These typically occur in extreme, unrecoverable cases, leading to JVM termination.
  • NoClassDefFoundError: Error occurs if the JVM cannot find the definition for a class present during compile time.

2. Java Exceptions

Exceptions, however, represent conditions that a program can recover from. They indicate problems that occur during the program's execution, but the program can often handle them in a controlled way to prevent a complete crash. For instance, if a file isn't found (FileNotFoundException), your program can prompt the user for a new path, offering a much better user experience than just crashing.

Here's a table summarizing the key differences:

Feature

Error

Exception

Nature Severe, unrecoverable problems Conditions a program can potentially handle
Origin JVM, system Program code, external factors
Handling Should not be caught Should be caught or declared
Compile-time Check Not checked Checked (for checked exceptions), Not checked (for unchecked/runtime exceptions)
Examples OutOfMemoryErrorStackOverflowErrorVirtualMachineError IOExceptionSQLException (checked), NullPointerExceptionIllegalArgumentException (unchecked)

Solidify your application's data backbone! Our Introduction to Database Design with MySQL course perfectly complements your mastery of Java exception handling, enabling you to build scalable systems. Explore the course today and connect with upGrad to architect your data effectively!

Also Read: Learn 50 Java Projects With Source Code (2025 Edition)

Now, let's shift our focus back to the heart of Java error management and explore practical implementations.

Coverage of AWS, Microsoft Azure and GCP services

Certification8 Months

Job-Linked Program

Bootcamp36 Weeks

Exception Handling in Java: Illustrative Examples and Code

The exception handling hierarchy in Java is a powerful mechanism for handling runtime errors, ensuring the normal application execution flow. Developers can manage exceptions effectively using try, catch, and finally blocks.

Catching a Single Exception

In Java, exceptions are objects that represent abnormal conditions during program execution. The most common way to handle exceptions is by using a try-catch block.

Code Example:

public class SingleExceptionExample {
    public static void main(String[] args) {
        int[] numbers = {1, 2, 3};
        try {
            // Attempt to access an invalid index
            System.out.println(numbers[5]);
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("Caught an exception: " + e);
        }
    }
}

Expected Output:

Caught an exception: java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 3

Explanation:

  • The try block contains code that might throw an exception.
  • If an exception occurs, the control is transferred to the corresponding catch block.
  • In this example, accessing numbers[5] throws an ArrayIndexOutOfBoundsException, which is caught and handled.

Catching Multiple Exceptions

Java 7 introduced the multi-catch feature, allowing multiple exception types to be caught in a single catch block. This feature is handy when exceptions of different types share the same handling logic, reducing code duplication and enhancing readability 

Code Example:

public class MultiCatchExample {
    public static void main(String[] args) {
        try {
            String input = "xyz";
            int number = Integer.parseInt(input); // Throws NumberFormatException
            int result = 10 / 0; // Throws ArithmeticException
        } catch (NumberFormatException | ArithmeticException e) {
            System.out.println("Caught an exception: " + e);
        }
    }
}

Expected Output:

Caught an exception: java.lang.NumberFormatException: For input string: "xyz"

Explanation:

  • The catch block handles both NumberFormatException and ArithmeticException.
  • The exception parameter (e) is implicitly final and cannot be reassigned.

Benefits of Catching Multiple Exceptions:

  • Reduced Code Duplication: When the error handling for several related exceptions is identical, you can avoid writing the same catch block multiple times.
  • Improved Readability: Combining the handling for similar exceptions makes the code shorter and easier to follow.
  • Simplified Maintenance: If the common handling logic needs to be updated, you only need to modify it in one place.

Elevate your software development prowess beyond error handling! upGrad’s Microsoft Gen AI Mastery Certificate for Software Development empowers you to integrate cutting-edge AI into your Java applications

Also Read: What is Hierarchial Inheritance in Java? With Examples

Having explored the power of catching multiple exceptions let's now broaden our perspective and understand how programmers navigate the structured world of exception hierarchy in Java

How Do Programmers Handle an Exception Hierarchy in Java?

Java provides programmers with several powerful mechanisms to prevent the abrupt termination caused by unhandled exceptions and maintain control over program flow.

These techniques allow developers to anticipate potential problems, gracefully manage errors when they occur, and ensure their applications' continued operation and stability.  Here are the primary ways they do this:

  • Try-Catch Blocks: The most common way to handle exceptions. Code that might throw an exception is placed in a try block. One or more catch blocks follow the try block to handle specific exceptions. 

    If an exception occurs in the try block, the corresponding catch block (matching the exception type) is executed. Programmers can define multiple catch blocks for different exception types, allowing for specific error handling based on the nature of the problem. A more specific catch block should always precede a more general one in the sequence.

  • Finally Block: An optional block that follows the try and catch blocks. The final block's code always executes, regardless of whether an exception was thrown or caught. This is typically used for cleanup operations (e.g., closing resources).
  • Throws Keyword: If a method might throw a checked exception that it doesn't handle, it must declare this using the throws keyword in its method signature. This shifts the responsibility of handling the exception to the calling method.
  • Throw Keyword: Programmers can explicitly throw exceptions using the throw keyword. This is useful for signaling error conditions that the program detects.
  • Custom Exceptions: Programmers can define their exception classes by extending the Exception class or its subclasses. This allows them to create exceptions specific to their application's needs.

Exception Chaining: When throwing exceptions, you can pass the original exception as a 'cause' to maintain the full context of the error. This is useful in multi-layered systems where a lower-level exception (e.g., a SQLException from the database layer) might be caught and re-thrown as a higher-level, more abstract exception (e.g., a DataAccessException in the service layer). By setting the cause, you preserve the entire stack trace, making debugging significantly easier.

Code Example:

public class DataAccessException extends Exception {
    public DataAccessException(String message, Throwable cause) {
        super(message, cause);
    }
}

public void saveData(Object data) throws DataAccessException {
    try {
        // Simulate a database operation that throws SQLException
        throw new java.sql.SQLException("Database connection failed!");
    } catch (java.sql.SQLException e) {
        // Catch SQLException and re-throw as a DataAccessException,
        // preserving the original SQLException as the cause.
        throw new DataAccessException("Failed to save data due to database error.", e);
    }
}

How Does JVM Handle an Exception Hierarchy in Java? The Default Behavior

When an exception occurs during the execution of a Java program and is not explicitly caught and handled by any try-catch block within the current method or any of the methods that called it, the Java Virtual Machine (JVM) steps in to manage the situation.

Here's a more detailed breakdown of the default process the JVM follows:

1. Exception Object Creation: The first action the JVM takes upon the occurrence of an exceptional condition is creating an exception object. This object is an instance of the specific exception class corresponding to the type of error encountered (e.g., NullPointerException, ArrayIndexOutOfBoundsException, IOException). This object encapsulates crucial information about the error, including:

  • The type of the exception: Indicating the nature of the problem.
  • A descriptive message: Providing a textual explanation of what went wrong. This message can be either the default message associated with the exception type or a custom message provided by the code that initially detected the error.
  • The stack trace: This critical piece of information records the sequence of method calls that led to the exception's occurrence. It essentially provides a history of the execution flow, making it invaluable for debugging and pinpointing the source of the error.

2. Search for an Exception Handler: Once the exception object is created, the JVM searches for an appropriate exception handler. This search proceeds up the call stack, a data structure that keeps track of the program's active method invocations. The JVM starts by looking for a catch block within the method where the exception originated.

  • If a catch block is found whose exception type matches the thrown exception type (or is a superclass of it), the JVM considers this a suitable handler. The program's execution then jumps to the code within this catch block, passing the exception object to it.
  • If no matching catch block is found in the current method, the JVM moves up the call stack to the process that called the current method. It repeats searching for a suitable catch block in that calling method.
  • This process continues, with the JVM traversing up the chain of method invocations until a matching exception handler is found or the top of the call stack is reached.

3. Handling or Termination:

  • Handler Found: If the JVM finds a catch block that can handle the exception, the code within that catch block is executed. After the catch block finishes its execution, the program typically continues its flow from the point after the try-catch block (unless it contains control-flow statements like return, break, or continue that alter the execution path).
  • Handler Not Found: If the JVM reaches the very top of the call stack without finding any method that handles the thrown exception, the default exception handler of the JVM is invoked. This results in the following:
    • The program's current thread of execution is terminated abruptly.
    • The exception's stack trace, exception type, and descriptive message are printed to the standard error stream (usually the console). This output provides crucial debugging information, showing exactly where the exception occurred and the sequence of calls leading up to it.

While mastering Java exception handling ensures your applications are robust, a versatile programmer's toolkit often includes Python. upGrads’ Learn Basic Python Programming course introduces you to another powerful language, expanding your problem-solving capabilities. Begin your Python journey today and broaden your coding horizons!

Although the JVM's default behavior provides useful debugging information, it is undesirable in production environments where unhandled exceptions should be handled gracefully. Unhandled exceptions leading to program termination can result in data loss, service interruptions, and a poor user experience.

This is why programmers employ the exception handling mechanisms provided by Java to take control of these situations and implement more graceful and robust error management strategies.

Java Exception Hierarchy: A Tree of Potential Issues

The Java exception hierarchy provides a structured and organized way to represent the various abnormal conditions during a Java program's execution. This hierarchical structure, resembling a tree, allows developers to understand the relationships between exceptions and errors, enabling more effective error handling and program design. 

By grasping the exception hierarchy in Java, programmers can write code that anticipates potential issues and responds appropriately, leading to more robust and reliable applications.

The Root: The Throwable Class

At the very apex of the exception hierarchy in Java lies the Throwable class. This abstract class serves as the ultimate superclass for all objects that can be thrown as exceptions or errors in Java. 

It establishes the fundamental contract for signaling abnormal conditions. Every exception and every error in the Java ecosystem is a subclass, directly or indirectly, of Throwable. This unifying root ensures a consistent mechanism for handling and propagating exceptional circumstances throughout the Java runtime environment.

The Two Main Branches: Error and Exception

Two primary branches directly extend the Throwable class: Error and Exception. This fundamental division distinguishes between severe, typically unrecoverable issues (Error) and conditions that a program might be able to handle (Exception).

  • Error: Represents serious problems that usually indicate a failure at the Java Virtual Machine (JVM) level or the operating system. Applications generally should not attempt to catch or recover from Errors.
  • Exception: Represents exceptional conditions that a program can catch and handle to prevent termination or take corrective actions.

Understanding this dichotomy is crucial for approaching different abnormal events in your code.

Exploring the Error Hierarchy

The Error branch encompasses various severe issues. Here's a glimpse into its structure:

Throwable
  └── Error
      ├── VirtualMachineError
      │   ├── OutOfMemoryError
      │   └── StackOverflowError
      ├── LinkageError
      │   ├── ClassFormatError
      │   ├── NoClassDefFoundError
      │   └── UnsatisfiedLinkError
      ├── AWTError

These errors, such as OutOfMemoryError (when the JVM runs out of memory) and StackOverflowError (due to excessive recursion), are typically beyond the control of the application logic. 

Attempting to catch them is generally not recommended as it often indicates a fundamentally compromised state of the JVM. The focus should be on preventing the conditions that lead to these errors.

Exploring the Exception Hierarchy Branch

The Exception branch handles most of the exception handling in typical Java applications. It is further divided into checked exceptions and unchecked exceptions, which are subclasses of RuntimeException.

Throwable 
└── Exception
 ├── Checked Exceptionx
 │ ├── IOException
 │ │ ├── FileNotFoundException
 │ │ └── SocketException 
│ ├── SQLException
 │ ├── ClassNotFoundException
 │ └── ... (other checked exceptions) 
└── RuntimeException (Unchecked Exception)
 ├── ArithmeticException
 ├── NullPointerException
 ├── IndexOutOfBoundsException
 │ ├── ArrayIndexOutOfBoundsException
 │ └── StringIndexOutOfBoundsException
 ├── IllegalArgumentException
 ├── ClassCastException
  • Checked Exceptions: These exceptions are checked at compile time. If a method might throw a checked exception, the process must either handle it (using a try-catch block) or declare it in its throws clause. 
  • Unchecked Exceptions (Runtime Exceptions): These exceptions are not checked at compile time. They typically result from programming errors and include exceptions like ArithmeticException (e.g., division by zero), NullPointerException (attempting to access a member of a null object), and IndexOutOfBoundsException (trying to access an array or string element with an invalid index). 

User-Defined Exception Hierarchy in Java

Java allows developers to create their custom exception classes to represent specific error conditions within their applications. These custom exceptions seamlessly integrate into the existing hierarchy.

  • To create a checked custom exception, you would typically extend the Exception class directly or one of its checked subclasses. This would require any method that might throw your custom exception to either handle it or declare it in its throws clause.
  • To create an unchecked custom exception, you would typically extend the RuntimeException class or one of its unchecked subclasses. These exceptions do not require explicit handling or declaration.

Creating custom exceptions allows you to provide more context-specific error information and build a more robust and maintainable application. They allow you to signal and handle errors in a way that aligns perfectly with your software's domain.

Just as mastering Java exception handling equips you to manage unexpected data behavior, upGrad’s Advanced SQL: Functions and Formulas course empowers you to manipulate and analyze data effectively within your databases. Enhance your data wrangling skills and connect with upGrad to unlock the full potential of SQL!

Let's explore the mechanics of exception handling in Java further by moving on to a detailed distinction between checked and unchecked exceptions.

Checked vs. Unchecked Exceptions: The Compiler's Rules

Java categorizes exceptions into checked and unchecked types, a fundamental distinction that governs how developers manage error conditions.

The compiler enforces checked exceptions, requiring explicit handling, while unchecked exceptions, often indicative of programming errors, do not have this requirement. This design impacts code robustness and error management strategies.

Here's a table summarizing the differences:

Feature Checked Exceptions Unchecked Exceptions
Compilation Check Checked at compile-time Not checked at compile-time
Handling Must be handled or declared Handling is optional
Recovery Often recoverable Typically indicates programming errors
Superclass Exception (excluding RuntimeException) RuntimeException or Error
Examples IOException, SQLException, ClassNotFoundException NullPointerException, IndexOutOfBoundsException, IllegalArgumentException

Hence, while CheckedExceptions must be declared or caught, UncheckedExceptions typically signal programming errors. Java encourages handling CheckedExceptions explicitly but leaves UncheckedExceptions to be dealt with during debugging and testing. 

Understanding this difference is crucial for writing robust Java code. Now, let's explore the difference between the exceptions provided by Java and those you can define yourself.

Built-in vs. User-Defined Exceptions

Java provides a set of built-in exceptions for common error scenarios, but developers can also create custom exceptions to handle specific application needs. 

Built-in exceptions offer a foundation for standard error handling. In contrast, user-defined exceptions allow greater precision and clarity in managing application-specific issues, leading to more maintainable and informative code.

Here's a table summarizing the differences:

Feature Built-in Exceptions User-Defined Exceptions
Source Java API (Standard Library) Created by developers
Purpose Handle common, general error scenarios Handle specific, application-related error conditions
Flexibility Less flexible (predefined and limited) Highly flexible (customizable to specific needs)
Examples IOException, SQLException, NullPointerException MyCheckedException, MyUncheckedException (custom)

Also Read: How to Code, Compile, and Run Java Projects in 2025

Choosing between built-in and user-defined exceptions depends on the granularity and specificity of error handling required by your application. 

Now that we understand these fundamental exception types, let's explore practical strategies for managing them in our code.

upGrad’s Exclusive Software Development Webinar for you –

SAAS Business – What is So Different?

 

Best Practices for Exception Handling: Writing Efficient Code

Effective exception handling is paramount for creating stable and maintainable Java applications. Adhering to certain best practices can significantly improve your code's resilience and make debugging much easier.

  • Be Specific in Catching: Instead of catching broad exception types like Exception, catch specific exceptions you expect might be thrown. This allows you to handle different error conditions in a targeted way.

try {
    // Some code that might throw SQLException or IOException
    databaseOperation();
    fileOperation();
} catch (SQLException e) {
    // Handle database-specific errors
    logger.error("Database error: " + e.getMessage(), e);
    // Attempt to recover or inform the user about the database issue
} catch (IOException e) {
    // Handle file-specific errors
    logger.error("File I/O error: " + e.getMessage(), e);
    // Attempt to recover or inform the user about the file issue
}

  • Handle Exceptions Gracefully: When an exception occurs, provide informative error messages to the user or take appropriate recovery actions within the application. Avoid displaying stack traces directly to end users, as this can be confusing and expose sensitive implementation details.

try {
    int result = divide(10, 0);
    System.out.println("Result: " + result);
} catch (ArithmeticException e) {
    System.err.println("Error: Cannot divide by zero. Please check your input.");
    // Optionally, log the exception for debugging
    logger.error("Division by zero attempted.", e);
}
  • Use ‘finally’ for Cleanup: The ‘finally’ block is crucial for ensuring that resources are released, regardless of whether an exception occurred in the try block. This is essential for preventing resource leaks.

InputStream inputStream = null;
try {
    inputStream = new FileInputStream("myFile.txt");
    // Perform operations with the input stream
    int data = inputStream.read();
    while (data != -1) {
        // Process data
        data = inputStream.read();
    }
} catch (IOException e) {
    logger.error("Error reading file.", e);
    // Handle the exception
} finally {
    if (inputStream != null) {
        try {
            inputStream.close();
        } catch (IOException e) {
            logger.error("Error closing input stream.", e);
        }
    }
}
  • Don't Ignore Exceptions: Empty ‘catch’ blocks should be avoided at all costs. Ignoring exceptions can lead to unexpected behavior and make debugging extremely difficult. At the very least, log the exception.

try {
    // Some potentially failing operation
     riskyOperation();
} catch (SomeException e) {
    // BAD PRACTICE: Ignoring the exception
}

try {
    // Some potentially failing operation
    riskyOperation();
} catch (SomeException e) {
    // BETTER PRACTICE: Logging the exception
    logger.error("An error occurred during risky operation.", e);
    // Optionally, take some default action or re-throw
}
  • Log Exceptions: Logging exceptions with sufficient detail, including the stack trace, is vital for debugging and understanding the root cause of errors in your application. Use a logging framework (like Log4j or SLF4j) for this purpose.
  • Throw Exceptions Early: If an error condition can be detected early in a method, throw an exception immediately. This prevents further execution in an invalid state and clarifies where the problem originated.

public void processData(String data) {
    if (data == null) {
        throw new IllegalArgumentException("Input data cannot be null.");
    }
    // Continue processing if data is valid
}
  • Document Exceptions: Document the exceptions a method might throw in its Javadoc. This helps other developers (and your future self) understand the potential error conditions they need to handle when calling your method.

/**
 * Processes the given data.
 * @param data The data to process. Cannot be null or empty.
 * @throws IllegalArgumentException if the data is null or empty.
 * @throws ProcessingException if an error occurs during data processing.
 */
public void processData(String data) throws IllegalArgumentException, ProcessingException {
    if (data == null || data.isEmpty()) {
        throw new IllegalArgumentException("Input data cannot be null or empty.");
    }
    try {
        // Perform data processing that might throw a ProcessingException
    } catch (Exception e) {
        throw new ProcessingException("Error during data processing: " + e.getMessage(), e);
    }
}
  • Wrap Low-Level Exceptions: When handling exceptions from lower-level libraries, consider wrapping them in custom application-specific exceptions. This provides better context for the error and prevents the leak of implementation details.

public void readFile(String filePath) throws FileProcessingException {
    try (FileInputStream fis = new FileInputStream(filePath)) {
        // Read from the file
    } catch (IOException e) {
        throw new FileProcessingException("Error reading file: " + filePath, e);
    }

Also Read: Top 135+ Java Interview Questions in 2025 

By consistently applying these best practices, you'll build a strong foundation for writing Java code that gracefully handles errors, improves application stability, and simplifies debugging.

How Can upGrad Help You Level Up Your Java Skills?

Feeling stuck in your Java journey or aiming for more advanced roles? To truly level up, focus on consistent practice through coding challenges and projects and actively contribute to open-source initiatives to gain real-world experience. Understanding design patterns and principles will significantly enhance your ability to write scalable and maintainable code.

Many Java developers struggle to bridge the gap between theoretical knowledge and practical application. To further accelerate your growth, upGrad offers an additional comprehensive program, the Full Stack Development Bootcamp, which is designed to transform you into a job-ready Java professional with a strong portfolio.

Ready to take the next step in your Java career and build upon your exception handling expertise? Connect with our team of experts today! We'll help you explore your goals and find the perfect program to advance your skills. You can also visit our offline centers to learn more in person.

Boost your career with our popular Software Engineering courses, offering hands-on training and expert guidance to turn you into a skilled software developer.

Master in-demand Software Development skills like coding, system design, DevOps, and agile methodologies to excel in today’s competitive tech industry.

Stay informed with our widely-read Software Development articles, covering everything from coding techniques to the latest advancements in software engineering.

Frequently Asked Questions (FAQs)

1. What's the biggest mistake beginners make when handling exception hierarchy in Java?

2. Can I create my own custom exception types in Java?

3. When should I choose a checked exception over an unchecked exception for a custom error?

4. Is it ever acceptable to catch a Throwable in Java?

5. How does the printStackTrace() method help in debugging?

6. What is the purpose of the "multi-catch" feature in Java?

7. How can I effectively log exceptions in a real-world application?

8. What is "exception re-throwing" and why would I use it?

9. Does catching exceptions impact application performance significantly?

10. What's the difference between a "checked exception" and a "compile-time exception"?

11. When should I use try-with-resources in Java?

Pavan Vadapalli

900 articles published

Director of Engineering @ upGrad. Motivated to leverage technology to solve problems. Seasoned leader for startups and fast moving orgs. Working on solving problems of scale and long term technology s...

Get Free Consultation

+91

By submitting, I accept the T&C and
Privacy Policy

India’s #1 Tech University

Executive PG Certification in AI-Powered Full Stack Development

77%

seats filled

View Program

Top Resources

Recommended Programs

upGrad

AWS | upGrad KnowledgeHut

AWS Certified Solutions Architect - Associate Training (SAA-C03)

69 Cloud Lab Simulations

Certification

32-Hr Training by Dustin Brimberry

upGrad

Microsoft | upGrad KnowledgeHut

Microsoft Azure Data Engineering Certification

Access Digital Learning Library

Certification

45 Hrs Live Expert-Led Training

upGrad

upGrad KnowledgeHut

Professional Certificate Program in UI/UX Design & Design Thinking

#1 Course for UI/UX Designers

Bootcamp

3 Months