0% found this document useful (0 votes)
48 views

Why Java Is Robust

This document discusses why Java is a robust programming language. It notes that Java is robust due to its memory management system, good exception handling capabilities, and use of try-catch blocks. Java has a dynamic memory management system that allocates and deallocates memory as needed. It also has a predefined library for representing and handling exceptions. Exceptions can be checked or unchecked, and Java provides keywords like try, catch, throw, and throws to facilitate exception handling.

Uploaded by

Gargi Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Why Java Is Robust

This document discusses why Java is a robust programming language. It notes that Java is robust due to its memory management system, good exception handling capabilities, and use of try-catch blocks. Java has a dynamic memory management system that allocates and deallocates memory as needed. It also has a predefined library for representing and handling exceptions. Exceptions can be checked or unchecked, and Java provides keywords like try, catch, throw, and throws to facilitate exception handling.

Uploaded by

Gargi Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

WHY JAVA IS ROBUST?

Presented by
Gargi Mishra
20Cse20
Key Points:
• Introduction
• Reason’s
• Exception
• Exception Handling
• Throw Keyword
• Throws Keyword
• Try-Catch-Finally
• Outcomes
What is Robustness?
Robustness refers to the ability of a system, program or process to
stand with error , faults or unexpected conditions without failing
completely.

Java is Robust:
Java is robust because it is a failproof programming Language.
Reasons behind java is robust :
• Memory Management System:

Java has a very good memory


management system in the form of Heap
memory management system, it is a
dynamic memory management
system, it allocates and deallocates
memory for the objects at runtime as
per the requirement.
Good Exception Handling:

• Java has a very good


Exception Handling
mechanism, because
Java has provided a
very good predefined
library to represent
and handle almost all
the exceptions which
are coming frequently
in Java applications.
Exception:
• Exception is an unexpected/abnormal
event occurred at runtime of the
application, which may be provided by
the users while entering dynamic input
to the java applications, which may be
provided by the Databases when we
perform database operations from java
applications in JDBC applications, which
may be provided by the network when
we establish connection between client
and Server in Distributed applications
and Causes abnormal termination to
the applications.
Type of Exception:
• There are two types of Exceptions in Java.
1. Predefined Exceptions:
• These exceptions are defined by the Java programming
languages, Java has provided predefined classes for these
exceptions in the Java predefined library.


1. User defined
Exceptions:
• These Exceptions are defined by the developers as per their application requirements.
• To address the user specific problem, We create the user defined exception .
• User defined exception is also known as Custom Exception .
• Sometimes we can create our own exception to meet our programming
requirements. dit
• Such type of exceptions are called customized exceptions (user defined e
exceptions).

• Ex:
to
• 1) InSufficientFundsException
• 2) TooYoungException h
• 3) TooOldException p
a
gr
a
ar
p

s
thi

t
ec
el
S
Classification of Predefined Exception:
• Checked Exception:
If any exception is identified by the compiler at compilation time the that
exception is called Checked Exception.
• Really exceptions occur at runtime only, not at compilation time, but
Compiler can recognize some exceptions which are going to generate at
runtime then that exceptions are also called “Checked Exceptions”.


Unchecked Exception:
The exception which are not checked by compiler are called unchecked
exceptions.
The compiler will not check these exceptions at compile time. In
simple words, if a program throws an unchecked exception, and even if
we didn't handle or declare it, the program would not give a
compilation error. Usually, it occurs when the user provides bad data
during the interaction with the program.
Example of predefined Exception:

Select this paragraph to edit


Exception Handling in Java:
• Exception Handling is facilitate with the help of following keyword.
• 1) try
• 2) catch
• 3) finally
• 4) Throw
• 5) throws
• Try Block:
• The try block encloses the statements that might raise an
exception within it and defines the scope of the exception
handlers associated with it.

• Catch Block:
• The catch block is used as an exception handler. You enclose
the code that you want to monitor inside a try block to handle
a run time error.

• Finally Block:
• The finally block is used to process certain statements, no
matter whether an exception is raised or not.
• Throw Keyword:
throw is a Java keyword, it can be used to raise or
generate an exception intentionally as per the
application requirement.

• Throws Keyword:
• throws is a Java keyword, it can be used to bypass the generated
exception from the present method to the caller method in order to
handle that exception.


Outcomes:
• Gain knowledge about Exception & Exception handling.
• Know reasons why java is Robust.
• Described different type of exception which occurred in java
programs.
• Learn how to handle checked and unchecked Exception .
Reference:
• Google
• ChatGPT
• GeeksforGeeks
• Javatpoint

Thank You

You might also like