Skip to content

YuriiJavaDev/JavaBasics_Task_268_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Wizard Toolkit: Static Nested Classes (JavaBasics_Task_268_V0.1)

📖 Description

In large systems, some components are logically related to a parent entity but do not require its state to function. This project demonstrates Static Nested Classes in Java. By declaring BasicCharm as static within Spellbook, we decouple the two. This allows the instantiation of BasicCharm without creating a Spellbook object, saving memory and simplifying the architecture when instance-specific data is not required.

📋 Requirements Compliance

  • Static Nesting: Defined BasicCharm as a static member of Spellbook.
  • Independent Instantiation: Demonstrated the new Outer.StaticNested() syntax which does not require an outer instance.
  • Method Execution: Implemented castSpell() to verify the independent lifecycle of the nested class.
  • Namespace Organization: Used the outer class primarily as a logical container (namespace).

🚀 Architectural Stack

  • Java 8+ (Static Nested Classes, Decoupled Design)

🏗️ Implementation Details

  • Spellbook: The outer namespace representing the collection.
  • BasicCharm: The independent static nested class.
  • SpellbookApp: The entry point demonstrating creation of the charm without a book.

📋 Expected result

Hello from static basic charm!

💻 Code Example

Project Structure:

JavaBasics_Task_268/
├── src/
│   └── com/yurii/pavlenko/
│                  ├── Spellbook.java
│                  └── SpellbookApp.java
└── README.md

Code

package com.yurii.pavlenko;

public class SpellbookApp {

    public static void main(String[] args) {

        Spellbook.BasicCharm charm = new Spellbook.BasicCharm();

        charm.castSpell();
    }
}
package com.yurii.pavlenko;

public class Spellbook {

    public static class BasicCharm {

        public void castSpell() {
            System.out.println("Hello from static basic charm!");
        }
    }
}

⚖️ 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_268_V0.1 Implementing static nested classes to model independent entities within a shared namespace. 230326_1051

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages