public class EjemploHiloPrioridad1{
    public static void main(String args[]){
        HiloPrioridad1 h1=new HiloPrioridad1();
        HiloPrioridad1 h2=new HiloPrioridad1();
        HiloPrioridad1 h3=new HiloPrioridad1();
        // Asignamos prioridades
        h1.setPriority(Thread.NORM_PRIORITY); // 5
        h2.setPriority(Thread.MAX_PRIORITY); // 10
        h3.setPriority(Thread.MIN_PRIORITY); // 5
        // Arrancamos
        h1.start();
        h2.start();
        h3.start();
        // Hacemos un conteo durante 10"
        try{Thread.sleep(10000);}catch(Exception e){}
        // Paramos los hilos
        h1.pararHilo();
        h2.pararHilo();
        h3.pararHilo();
        // Mostramos los contadores
        // No siempre el de mas prioridad gana a los otros
        System.out.println("h2 (Prioridad maxima): "+h2.getContador());
        System.out.println("h1 (Prioridad normal): "+h1.getContador());
        System.out.println("h3 (Prioridad minima): "+h3.getContador());
    }    
    
}
