I d'ont understand it it seems to me that the output is correct, the checks are in place and I use the run method as a recursive threag generator.
I am not very clear on what I am missing here.
Could you give a hand? :)
package com.codegym.task.task16.task1623;
/*
Creating threads recursively
*/
import java.awt.*;
public class Solution {
static int count = 15;
static volatile int createdThreadCount = 0;
public static void main(String[] args) throws InterruptedException {
new GenerateThread();
}
public static class GenerateThread extends Thread{
public GenerateThread() {
super(String.valueOf(++createdThreadCount));
start();
}
@Override
public void run() {
if(Solution.count >= createdThreadCount){
System.out.println(this);
new GenerateThread();
}
}
@Override
public String toString() {
return this.getName() + " created";
}
}
}