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

Enterprise Java Lab - Assignment 3

Uploaded by

Vijeth Poojary
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Enterprise Java Lab - Assignment 3

Uploaded by

Vijeth Poojary
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

NMAM.I.T.

, NITTE
DEPARTMENT OF MCA
II SEM MCA

18-07-2022
Enterprise Java Lab Assignment – 3

1. Write a java program to generate and handle NumberFormatException.


2. Write a single java program to handle Arithmetic, IndexOutOfBounds and
NullPointer exceptions using multiple catch blocks.
3. Write a program to demonstrate the use of throw keyword in the following
cases.
i. To throw built-in exception
ii. To throw user-defined exception.
4. Create a user defined class with a method splitString() which splits the string
passed in as a parameter when ‘/’ is found. If ‘/’ is not found in the string,
generate and handle exception. If ‘/’ is found or not, display the index of every
word in the string at the end.
5. Write a program to calculate the grade of a student. Handle the exceptions in the
following cases.
i. If the USN does not start with 4NM, the then handle invalidUsn
exception.
ii. If marks of any one of the subjects is less than zero or greater 100, handle
invalidMarks exception.
6. Create a program to demonstrate the different situations where finally block can
be used.
7. Write a JAVA program which has
i. A Class called Account that creates account with 500Rs minimum balance,
a deposit()method to deposit amount, a withdraw() method to withdraw
amount and also throwsLessBalanceException if an account holder tries
to withdraw money which makes thebalance become less than 500Rs.
ii. A Class called LessBalanceException which returns the statement that
says withdrawamount( Rs) is not valid.
iii. A Class which creates 2 accounts, both account deposit money and one
accounttries to withdraw more money which generates a
LessBalanceException takeappropriate action for the same.
8. Write a JAVA program to implement a Queue using user defined Exception
Handling(also make use of throw, throws.).

You might also like