创建赛道:
package com.huizhi;
import javax.swing.*;
import java.awt.*;
public class TwoQRun extends JFrame {
TwoQRun(){
setTitle("多线程:龟兔争霸");
setBackground(Color.WHITE);
setSize(1600, 500);
setLocation(0, 200);
setResizable(false);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
ThreadA threadA=new ThreadA();
ThreaB threaB=new ThreaB();
ThreadC threadC=new ThreadC();
threaB.start();
threadA.start();
threadC.start();
}
}
class ThreadA extends Thread{
public void run(){
}
}
class ThreaB extends Thread{
public void run(){
}
}
class ThreadC extends Thread{
TwoQRun twoQRun=new TwoQRun();
public void run(){
}
}