• Thread + 匿名内部类


    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();

    }

    }

  • 相关阅读:
    MySQL my.cnf详解
    函数:sleep-exit-wait
    fork-小实验
    OS-进程调度
    CET-4流程
    SDK和API的区别
    生活-金钱管理-不是理财
    算法设计与分析:Strassen矩阵乘法
    力扣:二进制加法求和
    算法设计与分析:大整数乘法
  • 原文地址:https://www.cnblogs.com/Koma-vv/p/9616159.html
Copyright © 2020-2023  润新知