Skip to content

Sangu111/Java-Lab-Programs

Repository files navigation

📚 Java Lab Programs

A complete collection of Java Lab Programs demonstrating core Java concepts for lab practice and placement preparation.


✅ Programs Covered


1️⃣

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

2️⃣

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

3️⃣ A

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

4️⃣

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

5️⃣

**Write a JAVA program using Synchronized Threads, which demonstrates the Producer-Consumer concept.

  • ProducerConsumerDemo.java

6️⃣

**Write a JAVA program to implement a Queue using User Defined Exception Handling (also make use of throw, throws).

  • QueueDemo.java

7️⃣

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

8️⃣

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

9️⃣

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

1️⃣1️⃣

Write a JAVA Program which uses FileInputStream / FileOutputStream Classes.

  • FileDemo.java

1️⃣2️⃣

**Write JAVA programs which demonstrate utilities of LinkedList Class.

  • LinkedListDemo.java

1️⃣3️⃣

**Write a JAVA program to implement JDBC operations.

  • JDBCOps.java

🚀 How to Compile & Run

1️⃣ Open terminal in your project folder.
2️⃣ Compile any program:

javac ConstructorOverloading.java

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages