package chapter01;
public class MyThread01 extends Thread{
@Override
public void run() {
//让当前线程执行的代码编写在run方法中
for(int i=0; i<=100; i++) {
System.out.println("发微信" + i);
}
}
}
--------------------------
package chapter01;
public class MyThread02 extends Thread{
@Override
public void run() {
for(int i=0;i<=100;i++){
System.out.println("qq"+i);
}
}
}
---------------------------、
package chapter01;
public class MyThread02 extends Thread{
@Override
public void run() {
for(int i=0;i<=100;i++){
System.out.println("qq"+i);
}
}
}
----------------------------
package chapter01;
/**
* Thread + 匿名内部类
*/
public class TestThread02 {
public static void main(String[] args) {
// 匿名内部类
Thread thread = new Thread() {
@Override
public void run() {
for (int i = 0; i <= 100; i++) {
System.out.println("++++++++" + i);
}
}
};
thread.start();
new Thread() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println("-------" + i);
}
}
}.start();
}
}