Skip to content

YuriiJavaDev/JavaBasics_Task_264_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Warehouse Automation: Inner Classes (JavaBasics_Task_264_V0.1)

📖 Description

In object-oriented design, some entities are so closely related that one cannot exist without the other. This project demonstrates the use of Non-static Inner Classes in Java. By nesting the Label class inside the Box class, we create a strong logical bond. An instance of Label is always tied to a specific instance of Box, reflecting real-world scenarios where a label is a physical part of a specific package.

📋 Requirements Compliance

  • Inner Class Implementation: Defined the Label class within the scope of the Box class.
  • Instance Dependency: Demonstrated that a Box object is required to instantiate a Label.
  • Method Access: Implemented the printLabel() method within the nested context.
  • Encapsulation: Showed how to reference inner types using the Outer.Inner syntax.

🚀 Architectural Stack

  • Java 8+ (Inner Classes, Object Coupling)

🏗️ Implementation Details

  • Box: The outer class representing the physical container.
  • Box.Label: The inner class representing the identification tag.
  • SolutionApp: The entry point managing the creation and linkage of these components.

📋 Expected result

Box label

💻 Code Example

Project Structure:

JavaBasics_Task_264/
├── src/
│   └── com/yurii/pavlenko/
│                  ├── Box.java
│                  └── SolutionApp.java
└── README.md

Code

package com.yurii.pavlenko;

public class SolutionApp {

    public static void main(String[] args) {

        Box box = new Box();
        Box.Label label = box.new Label();

        label.printLabel();
    }
}
package com.yurii.pavlenko;

public class Box {

    public class Label {

        public void printLabel() {
            System.out.println("Box label");
        }
    }
}

⚖️ 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_264_V0.1 Warehouse Automation: implementing non-static inner classes to represent tightly coupled components like a Box and its Label. 210326_1303

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages