게임강의
기타게임 분류

기타게임 간단한 자바 쓰레드

컨텐츠 정보

본문

[출처: Gamezone]
작성자: 작성자 없음

public class MyThread extends Thread {//쓰레드 정의

private int id = -1;
public MyThread(int id){
this.id = id;//생성할때 받을 인자
}
public void run(){
System.out.println( id + "Thread" );
try {
Thread.sleep(1000); //1초쉬고
} catch (InterruptedException e) {
e.printStackTrace();
}

System.out.println( "Thread OUT" );//쓰레드 끝
}

public static void main(String[] args) {
for(int i = 0 ; i < 10 ; i++ ){//10번 반복
MyThread t = new MyThread(i);//쓰레드 생성
t.start(); //쓰레드 시작
}

System.out.println("End");
}
}

관련자료

댓글 0
등록된 댓글이 없습니다.
전체 355 / 17 페이지
번호
제목
이름

강의실

🏆 포인트 랭킹 TOP 10
순위 닉네임 포인트
1 no_profile 타키야겐지쪽지보내기 자기소개 아이디로 검색 전체게시물 100,792
2 no_profile 동가리쪽지보내기 자기소개 아이디로 검색 전체게시물 58,079
3 no_profile 라프텔쪽지보내기 자기소개 아이디로 검색 전체게시물 51,771
4 no_profile 불멸의행복쪽지보내기 자기소개 아이디로 검색 전체게시물 36,366
5 서번트쪽지보내기 자기소개 아이디로 검색 전체게시물 35,011
6 no_profile 보거스쪽지보내기 자기소개 아이디로 검색 전체게시물 29,969
7 no_profile 닥터스쪽지보내기 자기소개 아이디로 검색 전체게시물 29,470
8 no_profile 검은고양이쪽지보내기 자기소개 아이디로 검색 전체게시물 29,077
9 no_profile Revolution쪽지보내기 자기소개 아이디로 검색 전체게시물 28,199
10 no_profile 냥집사쪽지보내기 자기소개 아이디로 검색 전체게시물 16,941
알림 0