в этой задаче получается мы в один объект трэд помещаем сразу три метода ран, разве так можно?
package com.javarush.task.task18.task1811;
/*
Wrapper (Decorator)
*/
public class Solution {
public static void main(String[] args) {
new Thread(new DecoratorRunnableImpl((new RunnableImpl()))).start();
}
public static class RunnableImpl implements Runnable {
@Override
public void run() {
System.out.println("RunnableImpl body");
}
}
public static class DecoratorRunnableImpl implements Runnable {
private Runnable component;
public DecoratorRunnableImpl(Runnable component) {
this.component = component;
}
@Override
public void run() {
System.out.print("DecoratorRunnableImpl body ");
component.run();
}
}
public static class DecoratorMyRunnableImpl implements Runnable{
}
}