Commit a5238353 authored by 季圣华's avatar 季圣华
Browse files

增加测试类

parent 12060b7e
package com.jsh.test;
public class MyRunnable implements Runnable {//实现Runnable接口
public void run(){
for(int i=0; i<30; i++){
System.out.println(Thread.currentThread().getName()+"运行, "+i); //获取当前线程的名称
}
}
}
\ No newline at end of file
package com.jsh.test;
public class MyThread {
public static void main(String[] args) {
for (int i = 0; i < 3; i++) {
MyRunnable mt = new MyRunnable(); //定义Runnable子类对象
new Thread(mt, "第" + i + "个线程").start();
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment