Skip to content

YuriiJavaDev/JavaBasics_Task_274_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Production Line: Runnable Anonymous Implementation (JavaBasics_Task_274_V0.1)

📖 Description

In industrial automation systems, certain tasks are executed once during a specific lifecycle event. This project demonstrates using an Anonymous Inner Class to implement the standard Java Runnable interface. By defining the logic directly within the startCountOperation method, we create a specialized, short-lived task. While this approach is functionally correct, it serves as a stepping stone toward understanding more modern functional programming patterns in Java.

📋 Requirements Compliance

  • Standard Interface: Utilized the built-in java.lang.Runnable interface.
  • Method Scope Implementation: Defined the anonymous class inside a specific instance method.
  • Immediate Execution: Triggered the run() method immediately after instantiation.
  • Encapsulation: Isolated the startup announcement logic within the production counter's domain.

🚀 Architectural Stack

  • Java 8+ (Interfaces, Anonymous Inner Classes, Task Execution)

🏗️ Implementation Details

  • ProductionCounter: Contains the core logic for counting operations.
  • AppLauncher: Dedicated class with the main method to bootstrap the application.

📋 Expected result

The counter has been started

💻 Code Example

Project Structure:

JavaBasics_Task_274/
├── src/
│   └── com/yurii/pavlenko/
│                  ├── ProductionCounter.java
│                  └── AppLauncher.java
└── README.md

Code

package com.yurii.pavlenko;

public class AppLauncher {

    public static void main(String[] args) {
        ProductionCounter counter = new ProductionCounter();
        counter.startCountOperation();
    }
}
package com.yurii.pavlenko;

public class ProductionCounter {

    public void startCountOperation() {

        Runnable startupTask = new Runnable() {
            @Override
            public void run() {
                System.out.println("The counter has been started");
            }
        };

        startupTask.run();
    }
}

⚖️ 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_274_V0.1 Production Line: implementing the Runnable interface via an anonymous inner class for immediate task execution. 240326_0949

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages