hi, in the output there is also the main thread displayed, i can't get rid of it. could somebody help please, thanks
package com.codegym.task.task16.task1623;
/*
Creating threads recursively
*/
public class Solution {
static int count = 15;
static volatile int createdThreadCount;
public static void main(String[] args) {
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(new GenerateThread());
}
}
@Override
public String toString() {
return Thread.currentThread().getName() + " created";
}
}
}