A repository containing all Java programs developed during Object Oriented Programming with Java Lab Sessions at Unitedworld School of Computational Intelligence (USCI), Karnavati University.
This repository serves as a resource for practicing and revising core Java concepts, OOP principles, and exception handling, along with some real-world problem-solving using Java. Each program is designed to help students solidify their understanding of Java programming.
- Print "Hello World! This is my First Java Program."
- Perform arithmetic operations (+, −, ×, ÷) on two numbers.
- Find the greatest of three entered numbers.
- Find the lowest of three entered numbers.
- Check whether a number is odd or even.
- Convert distance from KM to Miles and vice versa.
- Convert temperature from Celsius to Fahrenheit and vice versa.
- Print the Fibonacci sequence up to
nterms. - Compare two floating-point numbers up to three decimal places.
- Identify if the entered character is a vowel or consonant with error handling for invalid input.
- Check if a year is a leap year.
- Display the first 10 natural numbers.
- Display the multiplication table for a given number.
- Print a triangle pattern with repeating numbers:
1 22 333 4444 - Print a triangle pattern with incremented numbers:
1 2 3 4 5 6 7 8 9 10
- Add two numbers using class and object.
- Create a
Studentclass with marks for 3 subjects, calculate average. - Implement single inheritance using
PersonandEmployeeclasses. - Create a class hierarchy with a base class
Shape, and derived classesCircle,Rectangle, andTriangle. Implementarea()andperimeter()methods. - Develop a simple online shopping system using inheritance and polymorphism.
- Implement
BankAccount, with subclassesSavingsAccountandCheckingAccount, demonstrating method overriding.
- Create a bookstore management system using Java packages:
bookstore.book→ Class:Book(title, author, ISBN, price)bookstore.inventory→ Class:InventoryManager(add/update stock, retrieve book details)
- Find factorial of a number.
- Find sum of digits of a number.
- Handle
ArithmeticExceptionusing try-catch. - Handle
ArrayIndexOutOfBoundsExceptionusing try-catch. - Use
throwkeyword to create a custom exception. - Use
throwskeyword to handle a custom exception.
- Demonstrate multithreading with count from 1 to 5 with a 1-second delay.
- Perform autoboxing and unboxing.
- Use 5 methods from the
Mathclass. - Use 5 methods from the
Stringclass. - Use 5 methods from the
StringBufferclass.
JavaProgramsSem4/
├── Program01_HelloWorld.java
├── Program02_ArithmeticOperations.java
├── ...
├── bookstore/
│ ├── book/
│ │ └── Book.java
│ └── inventory/
│ └── InventoryManager.java
└── README.md
---
## 🤝 Contributing
Contributions are welcome!
If you’d like to improve a program, fix a bug, or add a new Java exercise, feel free to:
1. Fork the repository
2. Create a new branch (`git checkout -b feature-name`)
3. Commit your changes (`git commit -m 'Add new feature'`)
4. Push to the branch (`git push origin feature-name`)
5. Open a Pull Request
---
## 📜 License
This project is licensed under the [MIT License](LICENSE).
Feel free to use, modify, and distribute the code with attribution.
---
## 🙌 Acknowledgments
- Java Documentation: [docs.oracle.com](https://docs.oracle.com/javase/8/docs/)
- Lab Instructors and Faculty at USCI, Karnavati University
- Open-source contributors and the Java community
---
## ✨ Author
**Yash Wadhvani**
3rd Year B.Tech CSE Student
Unitedworld School of Computational Intelligence (USCI), Karnavati University
📫 [LinkedIn](https://www.linkedin.com/in/yashwadhvani/) • [GitHub](https://github.com/YashWadhvani)