Handling Errors: Advanced Topics in Exceptions

Java    |    Intermediate
  • 6 videos | 43m 21s
  • Includes Assessment
  • Earns a Badge
Rating 4.3 of 18 users Rating 4.3 of 18 users (18)
While handling exceptions is enough for most programmers, if you are building an app that other developers consume, you should know how to throw exceptions proactively and the various options available in Java in this regard. This is precisely the focus of this course. Learn about throwing an exception based on your conditions in a Java program and how nested function calls influence exception throwing and handling. You'll get a chance to explicitly throw an exception using the throw keyword, add complexity to your code by throwing different exceptions based on different conditions, and build a customized Exception class to define an exception that is not covered by Java's library. Having finished this course, you'll have the knowledge to throw exceptions and run your program without breaking its flow.

WHAT YOU WILL LEARN

  • Discover the key concepts covered in this course
    Use the throw keyword in java to explicitly throw an exception when the state of the program does not match your own set of valid conditions
    Invoke multiple exceptions in your program based on different error conditions
  • Throw and handle exceptions at various levels when nested function calls are involved
    Define your exception class by extending java's built-in exception
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 25s
    In this video, you’ll learn more about your instructor and this course. In this course, you’ll learn how you can throw an exception based on your own set of conditions in Java. You’ll employ the throw keyword to explicitly throw an exception. Then, you’ll add complexity to your code by throwing different exceptions based on different conditions. You’ll also look into how nested function calls influence exception throwing as well as handling. FREE ACCESS
  • 11m 37s
    In this video, you’ll learn about proactively throwing an exception. You’ll see this is especially useful if you build interfaces that are consumed by other developers. In this demo, you’ll see there's a new source file and class called ThrowExceptions. You’ll start with some code. In this example, you’ll need to import the Scanner class and then you’ll take a look at the main method. FREE ACCESS
  • Locked
    3.  Throwing Multiple Exceptions
    10m 14s
    In this video, you’ll watch a demo. In this demo, you’ll build upon the last demo and define a function that can throw two exceptions. To start off, you’ll clear out the main function, and then in the inputs, beyond the Scanner class, you’ll include javax.naming.InvalidNameException. You’ll see this is something that can be thrown in the event an invalid name is supplied to a function. FREE ACCESS
  • Locked
    4.  Chaining Exceptions
    8m 36s
    In this video, you’ll watch a demo. In this demo, you’ll see it’s possible to spread the handlers across the call stack methods. You’ll leave the validateStudent function as is, but you’ll modify the intermediateFunction. In this case, it handles both of the exceptions that could be thrown by validateStudent. You’ll change it so that it only handles the IllegalArgumentException and throws along the InvalidNameException. FREE ACCESS
  • Locked
    5.  Defining Custom Exceptions and Errors
    8m 36s
    In this video, you’ll watch a demo. In this demo, you’ll see that you might need to define your own exception classes. You’ll learn how to do that here. Onscreen, you’ll see a new class within your project called InvalidUsernameException. This is a custom exception. You might create something like this if you want it to be more specific in the case of an invalid username input. FREE ACCESS
  • Locked
    6.  Course Summary
    1m 52s
    In this video, you’ll summarize what you’ve learned in this course. In this course, you’ve learned how to throw exceptions proactively and the various options available in Java in this regard. You learned how to throw an exception based on your own conditions in a Java program. You then added complexity to your code by throwing different exceptions based on different sets of conditions and covered how this can be handled separately.  FREE ACCESS

EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.

YOU MIGHT ALSO LIKE

Rating 4.6 of 148 users Rating 4.6 of 148 users (148)
Rating 4.7 of 13 users Rating 4.7 of 13 users (13)
Rating 4.4 of 34 users Rating 4.4 of 34 users (34)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.5 of 70 users Rating 4.5 of 70 users (70)
Rating 4.5 of 73 users Rating 4.5 of 73 users (73)
Rating 4.6 of 1449 users Rating 4.6 of 1449 users (1449)