April 03, 2012

coding antivirus

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();
}
}

2 komentar:

  1. Thanks to Iqbal,.,.
    Please Visit My Blog :
    wawanhermawan74.blogspot.com

    BalasHapus
  2. SANTAP SIANG MURAH DI BELAKANG MASJID AL-AZHAR KALIMALANG :
    http://wawanhermawan74.blogspot.com/2010/11/santap-siang-murah-dibelakang-masjid-al.html

    BalasHapus