Skip to content

YuriiJavaDev/JavaBasics_Task_269_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Security Vault: Static Member Access (JavaBasics_Task_269_V0.1)

📖 Description

In secure system design, certain global parameters must be hidden from the outside world but accessible to internal monitoring modules. This project demonstrates how a Static Nested Class (SecurityDisplayUnit) can access a private static field (securityLevel) of its outer class (Vault). This pattern allows for clean logical grouping of utility or display components that depend on the global state of the parent class without requiring an instance of that parent.

📋 Requirements Compliance

  • Private Static Field: Encapsulated the securityLevel within the Vault class.
  • Static Nested Class: Implemented SecurityDisplayUnit as a static member to allow independent instantiation.
  • Internal Access: Proven that nested classes bypass standard private access restrictions of their outer class.
  • Independent Lifecycle: Successfully displayed the security level without creating a Vault object.

🚀 Architectural Stack

  • Java 8+ (Static Nested Classes, Static Field Access, Encapsulation)

🏗️ Implementation Details

  • Vault: The outer class containing the master security configuration.
  • SecurityDisplayUnit: The static nested class responsible for data visualization.
  • SecurityApp: The entry point for system verification.

📋 Expected result

Security level: 100

💻 Code Example

Project Structure:

JavaBasics_Task_269/
├── src/
│   └── com/yurii/pavlenko/
│                  ├── Vault.java
│                  └── SecurityApp.java
└── README.md

Code

package com.yurii.pavlenko;

public class SecurityApp {

    public static void main(String[] args) {

        Vault.SecurityDisplayUnit display = new Vault.SecurityDisplayUnit();

        display.showSecurityLevel();
    }
}
package com.yurii.pavlenko;

public class Vault {

    private static int securityLevel = 100;

    public static class SecurityDisplayUnit {

        public void showSecurityLevel() {
            System.out.println("Security level: " + Vault.securityLevel);
        }
    }
}

⚖️ 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_269_V0.1 Security Vault: demonstrating static nested class access to private static members of the outer class. 230326_1111

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages