0% found this document useful (0 votes)
4 views12 pages

Set 1

The document outlines a series of Java programming tasks, including creating interfaces, handling exceptions, file operations, and implementing multi-threading. It also includes examples of user-defined packages, linked list operations, and a JDBC application for user login validation. Each task is designed to enhance understanding of various Java concepts and functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

Set 1

The document outlines a series of Java programming tasks, including creating interfaces, handling exceptions, file operations, and implementing multi-threading. It also includes examples of user-defined packages, linked list operations, and a JDBC application for user login validation. Each task is designed to enhance understanding of various Java concepts and functionalities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

SET 1

1. Write a java program to create an interface named Shape that contains two integers and an empty
method named printArea (). Provide three classes named Rectangle, Triangle and Circle such that each
one of the classes implements the class Shape. Each one of the classes contains only the method
printArea () that prints the area of the given shape

2. Write a Java Program to create a user defined package for three classes Add, Sub, Mul.
3. Write a Java Program to find Math.pow(n,p). - If either n or p is negative, then the method must throw
an exception which says "n or p should not be negative.". - If both n and p are zero, then the method
must throw an exception which says "n and p should not be zero."
4. Write a Java Program to count number of invalid entries. Example: java example 5 2 a 1 b => Invalid =
2

5. Write a Java Program to demonstrate try with multiple catch block.


(ArithemeticException,NullPointerException, ArrayIndexOutOfBoundsException)
6. Write a Java Program to demonstrate NullPointerException.

7. Write a Java Program to demonstrate StringIndexOutOfBoundsException

8. Write a Java Program to demonstrate FileNotFoundException.


9. Write a Java program that copies the content of source.txt to destination.txt.

10. Write a Java program that reads a file and prints its content in reverse order.
11. Write a java program that displays the number of characters, lines and words in a text file.

12. Write a Java program that implements a multi-thread application that has three threads. First thread
generates random integer and displays “Good Morning” every one second, if the value is even, second
thread computes and prints “Hello” and If the value is odd, the third thread will print “Welcome”.
13. Write a Java program that implements a multi-thread application that has three threads. First thread
generates random integer every 1second and if the value is in between 1 to 100 , second thread computes
and prints Good. If the value is in between 101 to 200 , the third thread will print Morning.
14. Write a Java program to perform the following on LinkedList
Create a doubly linked list of elements.
Delete a given element from the above list.
Display the contents of the list after deletion.
15. Develop JDBC Application for user login and check whether user details are valid of not.
Name Passwor
d
Raju 123

Ramesh 789

Somesh 456

Sanjeev 345

Swathi 496

TEST CASE 1 TEST CASE 2 TEST CASE 3


Enter User Name: Enter User Name: Enter User Name:
Somesh Somesh Sanjeev
Enter Password: Enter Password: Enter Password:
456 345 345
OUTPUT: OUTPUT: OUTPUT:
Welcome Somesh Sorry Wrong Welcome Sanjeev
Details

You might also like