Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Menu
- layout
- 국제화
- 어노테이션
- 생성자
- AWT
- Graphic
- JSP
- 이클립스
- 클래스
- Spring
- oracle
- HTML
- paint
- Eclips
- 전화걸기
- Android
- 메소드
- Java
- 메서드
- 배열
- 예외처리
- 기본
- JavaScript
- 에러페이지
- struts2
- mybatis
- 안드로이드
- 오버로딩
- OGNL
Archives
- Today
- Total
note
Thread Priority 본문
package com.basic;//Thread Priority이용하여 우선순위 높이기
public class ThreadEx9 {
public static void main(String[] args){
ThreadEx9_1 th1 = new ThreadEx9_1();
ThreadEx9_2 th2 = new ThreadEx9_2();
//우선순위를 기본우선순위(5) - > 7
th2.setPriority(7);
System.out.println("Priority of th1(-) : "+th1.getPriority());
System.out.println("Priority of th2(|) : "+th2.getPriority());
th1.start();
th2.start();
}
}
class ThreadEx9_1 extends Thread{
public void run(){
for(int i=0;i<300;i++)
System.out.print("-");
}
}
class ThreadEx9_2 extends Thread{
public void run(){
for(int i=0;i<300;i++)
System.out.print("|");
}
}
Priority of th1(-) : 5
Priority of th2(|) : 7
---------------|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||-----------------------------------------------||||||||||||||||-|----||||||||
||||||||||---------|||||||||||||||||-|||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||-----------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----------------------------------------
'자바 > 스레드' 카테고리의 다른 글
swing으로 디지털 시계 만들기 (0) | 2012.01.02 |
---|---|
스레드 동기화 (0) | 2011.12.30 |
멀티 스레드 (0) | 2011.12.30 |
thread runnable (0) | 2011.12.30 |
스레드 (0) | 2011.12.30 |