Why Java Is Robust
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:
•
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:
• 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