摘要:
多线程的创建方式二:步骤 1、创建一个实现了Runnable接口的类 2、实现类中实现Runnable中的run()抽象方法 3、创建实现类的对象 4、将此对象作为参数传递到Thread类的构造器中,创建Thread类的对象 5、通过Thread类的对象调用start()方法。 /** * @des 阅读全文
摘要:
/** * @description:线程的优先级 * @date: 2020/7/25 15:56 * @author: winson */ public class ThreadPriority { public static void main(String[] args) { Priorit 阅读全文
摘要:
/** * @description:测试线程常用方法 * @date: 2020/7/25 15:12 * @author: winson */ public class ThreadMethodTest { public static void main(String[] args) { Hel 阅读全文
摘要:
/** * @description:练习:创建两个线程,一个线程遍历50内的偶数,一个线程遍历50内的奇数 * @date: 2020/7/25 11:02 * @author: winson */ public class CreateThread2 { public static void m 阅读全文
摘要:
一、多线程创建 可以通过两种方式创建多线程。 方式一:继承Thread类 1、创建一个继承于Thread类的子类 2、重写Thread类的run() --> 将此线程执行的操作声明在run()中 3、创建Thread类的子类的对象 4、通过此对象调用start() /** * @descriptio 阅读全文