package com.mstf.scme.test2;
public class RunnableSimple implements Runnable{
private int i=1;
public void run(){
for (; i < 20; i++) {
System.out.println(Thread.currentThread().getName()+"\t"+i);
}
}
public static void main(String[] args) {
RunnableSimple rs=new RunnableSimple();
Thread thread=new Thread(rs);
thread.setName("线程-A");
Thread thread2=new Thread(rs);
thread2.setName("线程-B");
thread.start();
thread2.start();
}
}
public class RunnableSimple implements Runnable{
private int i=1;
public void run(){
for (; i < 20; i++) {
System.out.println(Thread.currentThread().getName()+"\t"+i);
}
}
public static void main(String[] args) {
RunnableSimple rs=new RunnableSimple();
Thread thread=new Thread(rs);
thread.setName("线程-A");
Thread thread2=new Thread(rs);
thread2.setName("线程-B");
thread.start();
thread2.start();
}
}