A complete collection of Java Lab Programs demonstrating core Java concepts for lab practice and placement preparation.
i. Write a JAVA Program to demonstrate Constructor Overloading and Method Overloading.
Prog1a.java
ii. Write a JAVA Program to implement Inner Class and demonstrate its Access Protection.
Prog1b.java
Write a program in Java for String handling which performs the following:
i. Checks the capacity of StringBuffer
objects.
ii. Reverses the contents of string given on console and converts the resultant string to uppercase.
iii. Reads a string from console and appends it to the resultant string.
Prog2.java
i. Write a JAVA Program to demonstrate Inheritance.
Prog3a.java
(Simple Inheritance)
ii. Simple Program in Java for the implementation of Multiple Inheritance using Interfaces to calculate the area of a rectangle and triangle.
Prog3b.java
Write a JAVA program which has:
i. A Class called Account
that creates an account with ₹500 minimum balance, a deposit()
method to deposit amount, a withdraw()
method to withdraw amount and throws LessBalanceException
if an account holder tries to withdraw money which makes the balance less than ₹500.
Account.java
ii. A Class called LessBalanceException
which returns a statement that says withdraw amount (Rs) is not valid.
LessBalanceException.java
iii. A Class which creates 2 accounts, both deposit money and one tries to withdraw more money which generates LessBalanceException
and takes appropriate action.
BankDemo.java
**Write a JAVA program using Synchronized Threads, which demonstrates the Producer-Consumer concept.
ProducerConsumerDemo.java
**Write a JAVA program to implement a Queue using User Defined Exception Handling (also make use of throw
, throws
).
QueueDemo.java
Complete the following:
i. Create a package named shape
.
ii. Create classes in the package representing common shapes like Square, Triangle, and Circle.
iii. Import and compile these classes in another program.
shape/Square.java
shape/Triangle.java
shape/Circle.java
TestShapes.java
Write a JAVA Program to create an enumeration DayOfWeek
with seven values SUNDAY through SATURDAY. Add a method isWorkday()
to the DayOfWeek
class that returns true
if the value on which it is called is MONDAY through FRIDAY. For example, the call DayOfWeek.SUNDAY.isWorkday()
returns false
.
DayOfWeekTest.java
Write a JAVA program which has:
i. An Interface for Stack Operations
ii. A Class that implements the Stack Interface and creates a Fixed Length Stack
iii. A Class that implements the Stack Interface and creates a Dynamic Length Stack
iv. A Class that uses both Stacks through Interface reference and does Stack operations to demonstrate Runtime Binding.
StackDemo.java
**Write a JAVA program to print a Chessboard Pattern.
ChessBoard.java
Write a JAVA Program which uses FileInputStream
/ FileOutputStream
Classes.
FileDemo.java
**Write JAVA programs which demonstrate utilities of LinkedList
Class.
LinkedListDemo.java
**Write a JAVA program to implement JDBC operations.
JDBCOps.java
1️⃣ Open terminal in your project folder.
2️⃣ Compile any program:
javac ConstructorOverloading.java