JAVA
SP
T
TOPICS
HOME
📋
EXCEPTION HANDLING
Welcome to the repository of Java programs.
💡
1. Write a Java program that throws an exception and catch it using a try-catch block.
💡
2. Write a Java program to create a method that takes an integer as a parameter and throws an exception if the number is odd.
💡
3.Write a Java program to create a method that reads a file and throws an exception if the file is not found
💡
4. Write a Java program that reads a list of numbers from a file and throws an exception if any of the numbers are positive
💡
5.Write a Java program that reads a file and throws an exception if the file is empty.
💡
6.Write a Java program that reads a list of integers from the user and throws an exception if any numbers are duplicates
💡
7.Write a Java program to create a method that takes a string as input and throws an exception if the string does not contain vowels.
💡
8.Write a Java program to connect the Java API to Database, if connection not successful then throw an exception
💡
9.Write a Java program to manage the driver with path, username and password, if not successful then throw an exception
💡
10. Write a Java program to throw the SQL Query, insert, delete, update, if not successful then throw an exception
💡
11.Write a Java program to show an example of throws Keyword.
💡
12.Write a Java program to show an example of multiple catch
💡
13.Write a Java program to show an example of nested try block.