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

20th Jun 2018, 2:59 PM
PRANAV KOTHULE
PRANAV KOTHULE - avatar
1 ответ
+ 2
dont put the main inside runnable class. split them. and you can start the thread
20th Jun 2018, 4:31 PM
Kevin AS
Kevin AS - avatar