
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author felix
 */
public class ThreadA_ant {   
    public ThreadA_ant() {        
        ThreadB hilo = new ThreadB();
        hilo.start();
        
        System.out.println("El total es : " + hilo.total);
    }
    
    static public void main(String args[]) throws InterruptedException {
        new ThreadA_ant();
    } 
    
    class ThreadB extends Thread {
        int total;
        public ThreadB() {
            total = 0;
        }
        
        @Override
        public void run () {
            int i;
            
            for(i=0; i<100; i++) {
                try {
                    sleep(100);
                    total += 1;
                } catch (InterruptedException ex) {}
              
            }
        }
    }
}
