package com.day18.线程; public class ThreadOne { public static void main(String[] args) { MyThread mt1=new MyThread("线程1"); MyThread mt2=new MyThread("线程2"); MyThread mt3=new MyThread("线程3"); mt1.start(); mt2.start(); mt3.start(); System.out.println("MyThread1 id="+mt1.getId()); System.out.println("MyThread2 id="+mt2.getId()); System.out.println("MyThread2 id="+mt3.getId()); } } class MyThread extends Thread{ private String name; public MyThread (String name) { this.name=name; } @Override public void run() { System.out.println("MyThread is"+ name); } }