package com.citi.tm.api.trade.mongo; public class ThreadTest { public static void main(String[] args) { Runnable r = () -> { try { //Thread.currentThread().sleep(15000);//a, b, sleep Thread.sleep(15000);//a, b, sleep } catch (InterruptedException e) { e.printStackTrace(); } System.out.println( "Thread id:" + Thread.currentThread().getId() + ", Thread name:" + Thread.currentThread().getName()); }; Thread a = new Thread(r, "a"); Thread b = new Thread(r, "b"); System.out.println("start"); a.start(); b.start(); System.out.println("end"); } }