Create Thread

[Solved] Create Thread | Swift - Code Explorer | yomemimo.com
Question : create thread java

Answered by : homeless-hawk-uhi0pzmvkh3m

class RunnableObject implements Runnable { private Thread t; private String threadName; RunnableObject( String name) { System.out.println("Creating " + threadName ); threadName = name; t = new Thread (this, threadName); } public void run() { System.out.println("Running " + threadName ); } public void start () { System.out.println("Starting " + threadName ); t.start (); }
}
public class TestThread { public static void main(String args[]) { RunnableObject R1 = new RunnableObject( "Thread-1"); R1.start(); }
}

Source : | Last Update : Sat, 06 Feb 21

Answers related to create thread

Code Explorer Popular Question For Swift