rava2
home
documentation
examples
// retoor <retoor@molodetz.nl> public class Main { public static void main(String[] args) { System.out.println("=== Basic Threading Example ===\n"); System.out.println("Creating thread..."); Thread t1 = new Thread(() -> { System.out.println("[Thread-A] Starting"); for (int i = 1; i <= 5; i++) { System.out.println("[Thread-A] " + i); } System.out.println("[Thread-A] Done!"); }); System.out.println("Starting thread...\n"); t1.start(); t1.join(); System.out.println("\nThread completed."); } }
run program
ready