第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

若只有My Thread怎么回事?錯在哪了??

package seecen20160820例題;


public class Actor extends Thread{

? ? public void run(){

? ? System.out.println(Thread.currentThread(). getName()+"是一個演員!");

? ? int count =0;

? ? boolean keepRunning=true;

? ? while(keepRunning){

? ? System.out.println(Thread.currentThread().getName()+"登臺演出:"+( ++count) );

? ? if(count ==100){

? ? keepRunning =false;

? ? }

? ? if(count%10==0){

? ? try{

? ? Thread.sleep(1000);

? ? }catch(InterruptedException e){

? ? e.printStackTrace();

? ? }

? ? }

? ? }

? ? System.out.println(Thread.currentThread().getName()+"演出結(jié)束了!");

? ?

? ? }

? ? public static void main(String[] args) {

Thread actor =new Actor();

actor.setName("Mr.Thread");

actor.start();

?

Thread actressThread =new Thread(new Actress(),"Ms.Runnable");

actressThread.start();

? ?

} ?

}

class Actress implements Runnable{


@Override

public void run() {

}

}






正在回答

1 回答

你只設(shè)置了一個線程,只有My Thread,所以只會顯示My Thread。你的問題不是很清晰,你的意思是想要多個線程?



0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

若只有My Thread怎么回事?錯在哪了??

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號