Welcome to the Core Java Practical Labs repository for the course CSIT725. This repository contains lab exercises designed to enhance your understanding of Java programming. Each lab consists of Pre-Lab, In-Lab, and Post-Lab sections. You can view the solution for each task by clicking on the provided button.
- Lab 1: Java Fundamentals
- Lab 2: Classes and Objects
- Lab 3: I/O and GUI
- Lab 4: Constructors and Overloading
- Lab 5: Objects as Data Members
- Lab 6: Strings and String Manipulation
- Lab 7: Inheritance
- Lab 8: Polymorphism
- Lab 9: Exception Handling
- Lab 10: Multithreading
-
Develop Java code with 2 methods in
MyFirstClass
:
a)factorial()
b)isStrong()
(Determine if a number is strong)
-
Design a
Stock
class with attributes:symbol
,name
,previousClosingPrice
,currentPrice
, andgetChangePercent()
-
Write a menu-driven program to perform Linear Search, Binary Search, and Bubble Sort
-
Design a
QuadraticEquation
class with methodsgetDiscriminant()
,getRoot1()
, andgetRoot2()
-
Define a
Student
class with attributes Name, ID, Gender, Department
- Estimate the execution time of invoking the
linearSearch()
method in best, average, and worst cases
- Develop a java program that read the number of rows and columns through command-line, reads the set of elements in a 2D array from console. The menu driven program must perform the following operations:
a) Sum of all Elements
b) Print the data in matrix form
c) print the element of principal diagonal
d) print the sum of elements in Principal diagonal
-
Write a Java program that reads two integers from a file and prints their sum
-
Write a Java program that reads Student ID, Name, Age, and Gender, and displays them on a user interface
-
Develop a Java program to read from
Names.txt
andAddress.txt
and print the data in a specific format
-
Create a student registration page using Swing with ID, Name, Gender, and Department fields
-
Write a program to demonstrate constructor overloading with at least three constructors(MyInteger class which checks odd,even,prime)
-
Explain the differences between default and parameterized constructors in a class(Adding Factorial Method in MyInteger class)
-
Write a program to implement constructor chaining within a class(Account Class)
-
Demonstrate constructor overloading in inheritance with base and derived class(MyPoint Class)
- Write a reflection on the use of constructor overloading in Java, and when to use it effectively(ATM class)
- StackOfInteger Class
2. **Explain the use of objects as data members in classes. Provide examples**
[](https://github.com/121omprakash/Core_Java/blob/main/Lab%205/Pre_Lab/Pre_Lab_2_Object_Data_Member_Theory.md)
### In-Lab Tasks
1. **Write a program to implement composition, using a `Department` class as a data member of an `Employee` class**
[](https://github.com/121omprakash/Core_Java/blob/main/Lab%205/In_Lab/In_Lab_1_Composition.java)
2. **Modify the program to include `Address` as a data member in the `Employee` class and demonstrate how composition works**
[](https://github.com/121omprakash/Core_Java/blob/main/Lab%205/In_Lab/In_Lab_2_Address_Employee_Composition.java)
### Post-Lab Tasks
1. **Write a reflection on how composition enhances the design of object-oriented systems**
[](https://github.com/121omprakash/Core_Java/blob/main/Lab%205/Post_Lab/Post_Lab_1_Composition_Reflection.md)
---
## How to Run the Programs
1. **Clone the repository:**
```bash
git clone https://github.com/121omprakash/Core_Java.git
cd Core_Java