class Database {
public static synchronized void aksesDb(String objnm){
try{Thread.sleep(1000);}
catch(Exception e){}
System.out.println("Thread "+objnm+" is running1");
}
}
public class Antivirus{
public static void main(String[] args){
Thread update = new Thread (){
public void run(){
while(true){
try{Thread.currentThread().sleep(5000);}catch(Exception e){}
Database.aksesDb("update");
}
}
};
Thread scan_virus = new Thread (){
public void run(){
while(true){
try{Thread.currentThread().sleep(3000);}catch(Exception e){}
for(int i=0;i<5;i++){
Database.aksesDb("scanning for virus....");
try{Thread.currentThread().sleep(1000);}catch(Exception e){}
}
}
}
};
scan_virus.start();
update.start();
}
}
Thanks to Iqbal,.,.
BalasHapusPlease Visit My Blog :
wawanhermawan74.blogspot.com
SANTAP SIANG MURAH DI BELAKANG MASJID AL-AZHAR KALIMALANG :
BalasHapushttp://wawanhermawan74.blogspot.com/2010/11/santap-siang-murah-dibelakang-masjid-al.html