Skip to content

About

Advanced Java programs demonstrating custom exception handling, arrays, HashMap operations, and stack implementation using collection classes. Includes solutions to five tasks with screenshots and detailed examples.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Advanced: Exception Handling & Collections

Build Status License Java Repo Size


🚀 Overview

This repository contains advanced Java exercises (Q1–Q5) focusing on:

  • Custom Exception Handling
  • Input Validation
  • Java Collections Framework
  • HashMap operations
  • Stack implementation
  • User‑driven logic & error handling

All tasks include screenshots, organized source code, and a fully automated CI workflow.


📁 Project Structure

java-advanced-exceptions-collections/
│
├── .github/workflows/
│   └── java-build.yml
│
├── screenshots/
│   ├── 1.a.png
│   ├── 1.b.png
│   ├── 1.c.png
│   ├── 1.d.png
│   ├── 2.a.png
│   ├── 2.b.png
│   ├── 3.a.png
│   ├── 3.b.png
│   ├── 3.c.png
│   ├── 4.a.png
│   ├── 4.b.png
│   ├── 4.c.png
│   ├── 4.d.png
│   └── 5.png
│
├── src/
│   ├── AgeNotWithinRangeException.java
│   ├── NameNotValidException.java
│   ├── Student.java
│   ├── Voter.java
│   ├── QuestionThree.java
│   ├── QuestionFour.java
│   ├── QuestionFive.java
│   └── (supporting logic)
│
├── LICENSE
└── README.md

🧠 Task Breakdown

Q1 — Student Class with Custom Exceptions

Validates:

  • Age must be between 15–21
  • Name must not contain numbers or special symbols

Uses two custom exceptions:

  • AgeNotWithinRangeException
  • NameNotValidException

Q2 — Voter Age Validation

Ensures:

  • Age ≥ 18
    Else throws Invalid Age Exception.

Q3 — Weekday Array Handling

  • Takes a day index as input
  • Prints weekday name
  • Handles:
    • Invalid numeric input
    • Array out‑of‑bounds cases

Q4 — Student Grades Using HashMap

Supports:

  • Add student + grade
  • Remove student
  • Fetch grade

Uses:

HashMap<String, Integer>

Q5 — Stack Implementation (Collections)

Operations:

  • push()
  • pop()
  • isEmpty()

Uses:

Stack<Integer>

🖼️ Screenshots (Grid Layout)

Q1 — Student Management


Q2 — Voter Age Validation


Q3 — Weekday Array


Q4 — HashMap Grades


Q5 — Stack


▶️ How to Run

Clone

git clone https://github.com/TheComputationalCore/java-advanced-exceptions-collections.git

Navigate

cd java-advanced-exceptions-collections/src

Compile Everything

javac *.java

Run Any Task

java Student          # Q1
java Voter            # Q2
java QuestionThree    # Q3
java QuestionFour     # Q4
java QuestionFive     # Q5

📜 License

Distributed under the MIT License.


About

Advanced Java programs demonstrating custom exception handling, arrays, HashMap operations, and stack implementation using collection classes. Includes solutions to five tasks with screenshots and detailed examples.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages