Skip to content

YuriiJavaDev/JavaBasics_Task_251_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Digital Library Manager: Access Control Matrix (JavaBasics_Task_251_V0.1)

📖 Description

Security and modularity in Java are managed through access modifiers. This project simulates a library management system where different operations require different clearance levels. By implementing four methods with distinct modifiers, we visualize the accessibility hierarchy. The project demonstrates that while most operations are available to classes within the same package, strictly private tasks remain locked within the managing class itself.

📋 Requirements Compliance

  • Public Access: Universal visibility for general announcements.
  • Protected Access: Access for related classes and subclasses.
  • Package-Private Access: Internal module operations without explicit modifiers.
  • Private Access: Strict encapsulation for sensitive financial audits.

🚀 Architectural Stack

  • Java 8+ (Access Modifiers: public, protected, default, private)

🏗️ Implementation Details

  • DigitalLibraryManager: The core service defining the access policy.
  • DigitalLibraryApp: Entry point. The test bench located in the same package to verify visibility limits.

📋 Expected result

If the private method call is commented out:

The library is open to visitors!
A library staff meeting was held.
Book inventory completed.

💻 Code Example

Project Structure:

JavaBasics_Task_251/
├── src/
│   └── com/yurii/pavlenko/
│                  ├── DigitalLibraryManager.java
│                  └── DigitalLibraryApp.java
└── README.md

Code

package com.yurii.pavlenko;

public class DigitalLibraryApp {

    public static void main(String[] args) {
        DigitalLibraryManager manager = new DigitalLibraryManager();

        manager.announceOpening();
        manager.conductStaffMeeting();
        manager.manageBookInventory();

        /*
         * INACCESSIBLE: private
         * This line would cause a compilation error:
         * 'handleFinancialAudits() has private access in DigitalLibraryManager'
         */
        // manager.handleFinancialAudits();
    }
}
package com.yurii.pavlenko;

public class DigitalLibraryManager {

    public void announceOpening() {
        System.out.println("The library is open to visitors!");
    }

    protected void conductStaffMeeting() {
        System.out.println("A library staff meeting was held.");
    }

    void manageBookInventory() {
        System.out.println("Book inventory completed.");
    }

    private void handleFinancialAudits() {
        System.out.println("Financial audit completed successfully.");
    }
}

⚖️ License

This project is licensed under the MIT License.

Copyright (c) 2026 Yurii Pavlenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...

License: MIT

About

This is a tutorial project. JavaBasics_Task_251_V0.1 Digital Library Manager: comprehensive demonstration of all four Java access modifiers (public, protected, package-private, private) and their visibility boundaries. 170326_1353

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages