본문 바로가기

자바의 정석 기초편 코드 분석16

자바의 정석 기초편 코드 분석 127(예제 13-3) [ ] 자바의 정석 기초편 카테고리 chapter 13 쓰레드 chapter 13-10 싱글쓰레드와 멀티쓰레드 예제2 예제 13-3 [ ] 코드 분석 1. 원본 코드 class Ex13_3 { static void startTime = 0; public static void main(String args[]) { ThreadEx3_1 th1 = new ThreadEx3_1(); th1.start(); startTime = System.currentTimeMillis(); for(int i=0; i < 300; i++) System.out.printf("%s", new String("-")); System.out.print("소요시간1: " + (System.currentTimeMillis() - Ex13.. 2023. 9. 25.
자바의 정석 기초편 코드 분석 126(예제 13-2) [ ] 자바의 정석 기초편 카테고리 chapter 13 쓰레드 chapter 13-9 싱글쓰레드와 멀티쓰레드 예제1 예제 13-2 [ ] 코드 분석 1. 원본 코드 class Ex13_2 { public static void main(String args[]) { long startTime = System.currentTimeMillis(); for(int i=0; i < 300; i++) System.out.printf("%s", new String("-")); System.out.print("소요시간1:" +(System.currentTimeMillis()- startTime)); for(int i=0; i < 300; i++) { System.out.printf("%s", new String("|".. 2023. 9. 25.
자바의 정석 기초편 코드 분석 125(예제 13-1) [ ] 자바의 정석 기초편 카테고리 chapter 13 쓰레드 chapter 13-4 쓰레드의 구현과 실행 예제 예제 13-1 [ ] 코드 분석 1. 원본 코드 class Ex13_1 { public static void main(String args[]) { ThreadEx1_1 t1 = new ThreadEx1_1(); Runnable r = new ThreadEx1_2(); Thread t2 = new Thread(r);// 생성자 Thread(Runnable target) t1.start(); t2.start(); } } class ThreadEx1_1 extends Thread { public void run() { for(int i=0; i < 5; i++) { System.out.printl.. 2023. 9. 25.
자바의 정석 기초편 코드 분석 124(예제 12-8) [ ] 자바의 정석 기초편 카테고리 chapter 12 지네릭스, 열거형, 애너테이션 chapter 12 에너테이션의 활용 예제 예제 12-8 [ ] 코드 분석 1. 원본 코드 import java.lang.annotation.*; @Deprecated @SuppressWarning("1111") // 유효하지 않은 애너테이션은 무시된다. @TestInfo(testedBy="aaa", testDate=@DateTime(yymmdd="160101", hhmmss="235959")) class Ex12_8 { public static void main(String args[]) { // Ex12_8의 class 객체를 얻는다. Class cls = Ex12_8.class; // TestInfo anno = .. 2023. 9. 25.