SET 2
SET 2
1. Write a Java programming to perform sample ATM operations .Create an interface Account contains
three methods named getBalance(),deposit() , withdrawal().And create a class SavingsAccount that
should implement the Account interface methods.
2. Write a java program that connects to a database using JDBC and does add, delete, modify and retrieve
operations.
3. Write a Java Program to Reverse ArrayList.
4. Write a Java program that implements a multi-thread application that has three threads. First thread
generates random integer every 1 second and if the value is even, second thread computes the factorial
of the number and prints. If the value is odd, the third thread will print the value of cube of the number.
5. Write a Java program that counts the number of words in a given text file.
6. Write a Java program to perform the following on LinkedList
Create a Singly linked list of elements.
Delete a given element from the above list.
Display the contents of the list after deletion.
7. Write a Java Program to demonstrate NegativeArraySizeException.
8. Write a Java Program to implement inheritance with respect to Interfaces.
9. Write a Java program that takes user input from the console and writes it to a file.
10. Write a Java Program to demonstrate IOException.
11. Write a java program that reads a file name from the user, and then displays information about whether
the file exists, whether the file is readable, whether the file is writable, the type of file and the length of
the file in bytes.
12. Write a Java Program to import a user defined package.
13. Write a Java Program that reads two integers by passing arguments to main() and find sum of squares of
2 2
two integers. Handle ArrayIndexOutOfBoundsException. (result=x +y )
14. Write a Java program that writes "Hello, World!" to a file named hello.txt and then reads the content
from the same file and displays it on the console.
15. Write a program to perform integer divisions. The user enters two numbers, Num1 and Num2. The
division of Num1 and Num2 is displayed. If Num1 or Num2 were not an integer, the program would
throw a NumberFormatException. If Num2 were Zero, the program would throw an
ArithmeticException. Display the exception.