#Is this good composition class ?

1 messages · Page 1 of 1 (latest)

vapid loom
#
public class ThreadComposition implements Runnable {
    private String name;
    private final Thread thread;

    public ThreadComposition(String name) {
        this.name = name;
        thread = new Thread(this);
    }

    @Override
    public void run() {
        for (int i=0; i<10; i++) {
            for (int j=0; j<50000; j++) {
                System.out.println("Thread " + name + " running");
            }
        }
    }

    public void start() {
        thread.start();
    }
}
half gullBOT
#

This post has been reserved for your question.

Hey @vapid loom! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.