Differences Between Throw and Throws

Start course
Overview
Difficulty
Beginner
Duration
50m
Students
24
Description

In this course, we'll learn about Exception Handling in Java.

Learning Objectives

  • What is an Exception?
  • Difference between Error and Exception
  • Types of Exceptions
  • Try-Catch Block
  • Finally Block
  • Throw and Throws Keywords
  • Exception Methods

Intended Audience

  • Anyone looking to get Oracle Java Certification
  • Those who want to learn the Java Programming language from scratch
  • Java developers who want to increase their knowledge
  • Beginners with no previous coding experience in Java programming
  • Those who want to learn tips and tricks in Oracle Certified Associate – Java SE 8 Programmer certification exams

Prerequisites

  • No prior knowledge is required about the Java programming language
  • Basic computer knowledge
Transcript

Hi there. In the previous video, we learned the Throw and Throws keywords. In this video, we'll look at the differences between the throw and throws keyword. Let's compare the Throw and Throws keywords by using a table to understand better. The Throw keyword is used to explicitly throw an exception, Throws keyword is used to declare an exception. The Throw is followed by an instance, Throws is followed by class. The Throw is used within the method, Throws is used with the method signature. We can declare only one exception with a throw at a time, we can declare multiple exceptions with throws at a time. Yes, those are the main differences between the keywords, Throw and Throws. Let's take a short break here. See you in the next lesson.

 

About the Author
Students
512
Courses
47
Learning Paths
3

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.

Covered Topics