1. 创建线程的三种方法及其区别 1.1 继承Thread类 首先,定义Thread类的子类并重写run()方法: package com.zwwhnly.springbootaction.javabase.thread; public class MyFirstThread extends Thread { @Override public void run() { for (int i = 0; i < 5; i++) { System.out.printf("[MyFirstThre…
package unit8; import java.applet.Applet; import java.awt.Label; import java.awt.TextField; public class TestRunnable extends Applet implements Runnable{ Label prompt1 = new Label("The first thread:"); Label prompt2 = new Label ("The second…