0
Is this proper use of threads
Please check the code below. Program prints numbers from 1-99 and than 99 times word "Hello". class Loader implements Runnable { public void run() { System.out.println("Hello"); } } class MyClass { public static void main(String[ ] args) { for (int i=1; i<100; i++) { System.out.println (i); Thread t = new Thread(new Loader()); t.start(); } } }
1 Respuesta
+ 1
yes it is.
Threads are used when you want multiple things to run in your program at the same time.