1.继承Thread类,重写该类的run()方法. package samTest; import java.util.Scanner; /** * Created by Sam on 2018-01-02. */ public class ThreadTest { public static void main(String[] args) { Scanner in = new Scanner(System.in); for (int i = 0; i < 3; i++) { int flag…