JAVA
Java | Thread Demo in java
Thread- Example In java
/** * */ /** * @author venugopal darur * */ /** * * @author venugopal darur * * * */ public class ThreadDemo { /** * * @param args * */ public static void main(String[] args) { Thread oneThread = Thread.currentThread(); System.out.println(":CURRENT THREAD NAME: " + oneThread); // How to get the Thread Name: oneThread.setName("IFORERUNNER THREAD"); System.out.println(":CURRENT THREAD NAME: " + oneThread.getName()); int i = 0; // making you program run for ever use while loop with some condtion( if // you have any) for every minute while (true) { long minute = 60 * 1000; System.out.println(minute); System.out.println(i++);// here we are priting i and minute, you can // implement your own action try { Thread.sleep(minute ); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com