Core Java Tutorials


Introduction

Java Hello World

Java Compilation

JDK New Features

JVM Architecture

Java OOPs Concepts

Java Package

Array

Exception Handling

String

Immutable Class

File Handling

Serialization

MultiThreading

Volatile

Concurrent Package

Collection

Collection Internal

Generics

Cloning

Reflection In Java

Annotation

Class Loader

Java Inner classes

Garbage Collector

JDBC

References In Java

Heap Dump & Thread Dump

Throw & Throws In Java

Throw and throws are keywords are used to deal with exception handling in java program. Using throw keyword "programer" or "JRE" can throw the exception when any un-wanted condition comes at run time and throws is used to declarare the exception after method declaration , in case programer does not want to handle it inside the definition of the method. Now it's method caller responsibility to handle the exception.


  Example of throw keyword:
throw-keyword-in-java

  Example of throws keyword:
throws-keyword-in-java