NUTAN MAHARASHTRA VIDYA PRASARAK MANDAL’S
NUTAN COLLEGE OF ENGINEERING & RESEARCH (NCER)
Department of Computer Science and Engineering
Second Year Engineering
---------------------------------------------------------------------------------------------------------------------
Experiment No – 09
Programs on Exception Handling
(Note: Solve Following Program Take Printout with output and attached.)
1.Write a program to create own exception(user defined exception) to accept no
from user and throw an exception if the number is not Even.
2.Write a program to create own exception(user defined exception) to accept no
from user and throw an exception if the number is not Prime.
3.Write a program to create own exception(user defined exception) to accept age
from user and throw an exception if the age is negative.
4.Write a program to create own exception(user defined exception) to accept String
from user and throw an exception if the String is not starting character ‘s’.
5.Write a program to create own exception(user defined exception) to accept
Password from user and throw an “AuthenticationFailure” exception if the
Password is incorrect.
Practical Related Questions
1. What is Exception handling?
2. Explain try,catch,throw and throws with details
3. Explain multiple catch statements.
4. Explain finally keyword
Prof.S.B.Mehta
Subject In-charge
Object Oriented Programming using Java 1 BTCOL409