Problem 1
Explain how exception handling mechanism can be used in a program.
Problem 2
How many catch blocks and finally blocks can we use with try block?
Problem 5
Define an exception called "NoEqualException" that is thrown when a float value is not equal to \(3.14\). Write a program that uses the above user defined exception.
Problem 7
Write a program that reads the name of a file and computes the number of lines in the file that represent integers. Use Integer.parseInt to parse complete line read from the file. Use Java's Exception mechanism to detect when a given line is not a valid int.
Problem 8
Can a try block have two finally block? Prove it.
Problem 10
Does Java permit a try block to have two catch blocks for the exact same exception? Prove it.
Problem 12
Define an exception called "NoMatchException" that is thrown when a string is not equal to "India". Write a program that uses this exception.
Problem 13
Write a program to demonstrate the use of exception handling.
Problem 14
Write a program for user defined exception that checks the internal and extemal marks; if the internal marks is greater than 40 it raises the exception "Internal marks is exceed"; if the external marks is greater than 60 it raises the exception and displays the message "The External Marks is exceed". Create the above exception and use it in your program.