请在 下方输入 要搜索的题目:

Java中如何编写线程

Java中如何编写线程

发布时间:2025-12-01 21:20:16
推荐参考答案 ( 由 题搜搜 官方老师解答 )
答案:

       Tread thread = new Thread;

       多个线程

       public class Double {

              public static void main(String] args){

                     Mythread one=new Mythread();

                     Mythread two=new Mythread();

                     one.setName("线程一");

                     two.setName("线程二");

                     one.start();

                     two.start();

              }

       }

       class Mythread extends Thread

       {

              public void run(){

                     System.out.println(this.getName());

              }

       }

登录 - 搜搜题库网
立即注册
注册 - 搜搜题库网
立即登录