The last points are good but they probably wanted to make threads from 1 to 15 not, 1, 1 ... , 14, but I havent idea how to fix it.
package pl.codegym.task.task16.task1623;
/*
Rekurencyjne tworzenie wątków
*/
public class Solution {
static int count = 15;
static volatile int createdThreadCount;
public static void main(String[] args) {
System.out.println(new GenerateThread());
}
public static class GenerateThread extends Thread {
public GenerateThread() {
super(String.valueOf(++createdThreadCount));
start();
}
@Override
public void run() {
if (createdThreadCount < count) {
System.out.println(this.toString());
}
if (createdThreadCount < count) {
new GenerateThread();
}
}
@Override
public String toString() {
return getName() + " utworzony";
}
}
}