0
Multi threading (infinite loop) ?
public class Program implements Runnable { public void run() { for(int i=0;i>-1;i++){ System.out.println ("java"); } } public static void main(String[] args) { Program p=new Program(); Thread t= new Thread(p); for(int i=0;i>-1;i++){ System.out.println ("oracle"); } Thread.sleep(1000); t.start(); } }
1 Réponse
+ 2
dont put the main inside runnable class. split them. and you can start the thread