class ClasseAttiva extends Thread{
    public void run(){
        while (true) {
            try {
                Thread.sleep(100);
            }
            catch(InterruptedException e){
                System.err.println(e);
            }
            System.out.println(this.getName());
        }
    }
}

public class Basic {
    public static final void main(final String[] args) {
        ClasseAttiva o1 = new ClasseAttiva();
        ClasseAttiva o2 = new ClasseAttiva();
        o1.start();
        o2.start();
        while (true){
            try {
                Thread.sleep(100);
            }
            catch(InterruptedException e){
                System.err.println(e);
            }

            System.out.println("Main thread");
        }
        
    }
}

