Java Experiment list
EXP NO EXPERIMENT
1. Write a Java program to create a class called "Book" with instance variables title, author, and price.
Implement a default constructor and two parameterized constructors:
One constructor takes title and author as parameters.
The other constructor takes title, author, and price as parameters.
Print the values of the variables for each constructor.
2. Write a Java programming to create a banking system with three classes - Bank, Account,
SavingsAccount, and CurrentAccount. The bank should have a list of accounts and methods for adding
them. Accounts should be an interface with methods to deposit, withdraw, calculate interest, and view
balances. SavingsAccount and CurrentAccount should implement the Account interface and have their
own unique methods.
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 to implement a lambda expression to sort a list of strings in alphabetical order.
5. Write a Java program to calculate the sum of all even, odd numbers in a list using streams.
6. Write a Java program that calculates the sum of all prime numbers using multiple threads.
7. Write a Java program that calculates the sum of all prime numbers up to a given limit using multiple
threads.
8. Write a Java program to create a class called Student with private instance variables student_id,
student_name, and grades. Provide public getter and setter methods to access and modify the student_id
and student_name variables. However, provide a method called addGrade() that allows adding a grade to
the grades variable while performing additional validation.
9. Write a Java program to create a base class Animal with methods move() and makeSound(). Create two
subclasses Bird and [Link] the move() method in each subclass to describe how each animal
moves. Also, override the makeSound() method in each subclass to make a specific sound for each
animal.
10. Write a Java program to iterate a linked list in reverse order
Write a Java program to search for an element in an array list.