// implement file: MyThread.java
//package org.lxh.demo16.thd;/*** 定义一个线程类* @author Owner**/
class MyThd extends Thread {private String name;public MyThd(String name) {this.name = name;}public void run() {for(int i = 0; i < 100; i++) {System.out.println(name + "run, i=" + i + "-->" + Thread.currentThread().getName());}}}/*** 这个类是演示使用线程的* @author Owner**/
public class MyThread extends Thread {public MyThread() {}/*** @param args*/public static void main(String[] args) {// TODO Auto-generated method stubMyThd thd1 = new MyThd("Thd A ");MyThd thd2 = new MyThd("Thd B ");//error//thd1.run();//thd2.run();//start threadthd1.start();thd2.start();new MyThd("Test thread").start();}}