Fichier #orrpdo31-2877 - JAVA - Code source
Téléchargé par un utilisateur anonyme - 09/03/2010 21:29 - 71 affichages
Code source
class Threads{public static void main(String args[])
{new Thread1().start();
}}class Thread1 extends Thread
{public void run()
{int counter = 1;
while (counter < 4)
{try
{sleep(1000); //pause the thread for 1 second
System.out.println(counter); //print the number of seconds
}catch (InterruptedException e){ } //exception must be caught to allow the sleep method to work
counter++;}stop(); //stops the current thread
}}
