Java Threads | Create multiple threads with Runnable

Download code here

Threading.java
public class Threading{
    public static void main(String[]args){
        Runnable r = ()->System.out.printf(
            "Current: %s%n",
            Thread.currentThread().getName()
        );
        for(int i = 1; 5 >= i; i ++) new Thread(r).start();
    }
}

Comments

Popular posts from this blog