This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| // 선택 과제를 진행하면서 Stream을 활용하고 정규식에 대해 공부할 수 있었습니다. | |
| import java.util.Arrays; | |
| import java.util.Scanner; | |
| class InvalidInputException extends RuntimeException { | |
| public InvalidInputException(String message) { | |
| super(message); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| // Java 마스터 주차의 강의들은 갑자기 난이도가 올라가면서 생소하고 어려웠습니다. 정리하고 복습해 익숙해지도록 노력하겠습니다!! | |
| import java.lang.annotation.ElementType; | |
| import java.lang.annotation.Retention; | |
| import java.lang.annotation.RetentionPolicy; | |
| import java.lang.annotation.Target; | |
| import java.lang.reflect.Field; | |
| class JsonSerializationException extends RuntimeException { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 김상희 | |
| * 과제 내용: 디자인 패턴 1개 이상 구현해보고 정리하기 | |
| * Strategy Pattern 기본 예제 - 결제 방식 | |
| * | |
| * Strategy Pattern이란? | |
| * - 알고리즘(전략)을 정의하고, 각각을 캡슐화하여 교환 가능하게 만드는 패턴 | |
| * - 런타임에 알고리즘을 선택할 수 있음 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package dev.sh.assignment; | |
| import java.io.*; | |
| import java.nio.file.*; | |
| import java.util.function.*; | |
| import java.util.stream.*; | |
| /** | |
| * 김상희 | |
| * 과제 내용: 임의의 txt 파일을 읽어, 모든 라인을 대문자로 바꾸어 출력 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.lang.annotation.*; | |
| import java.lang.reflect.*; | |
| /** | |
| * 김상희 | |
| * Annotation과 Reflection을 활용해 Custom Logging 구현 | |
| * Annotation = 코드에 설명이나 표시를 달아놓는 것. 실행에는 영향 없고, 읽어서 활용할 수 있음 | |
| * Reflection = 실행 중에 클래스/메서드/필드 정보를 읽고 조작하는 기능 | |
| * | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| import java.util.*; | |
| class Lotto { | |
| private int[] numbers = new int[6]; | |
| public Lotto() { | |
| createLottoNumber(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| /* | |
| 오차 방지를 위한 정수 연산 사용: | |
| - 부동소수점 연산(double, float)은 이진수 표현의 한계로 인해 미세한 오차 발생 | |
| - 예: 48000000 * 0.24 = 11520000.0 → (long) 변환 시 정밀도 손실 가능 | |
| - 정수 연산: 48000000 * 24 / 100 = 11520000 (정확) | |
| - 곱셈을 먼저 수행한 후 나눗셈을 수행하여 정밀도 유지 | |
| */ | |
| import java.util.ArrayList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| import java.util.concurrent.CompletableFuture; | |
| class PaymentFailureException extends RuntimeException { | |
| public PaymentFailureException(String message) { | |
| super(message); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| import java.util.List; | |
| import java.util.stream.LongStream; | |
| // 대량 숫자 리스트 합계 계산 | |
| public class ParallelStreamSumAssignment { | |
| public static void main(String[] args) { | |
| System.out.println("> Task: ParallelStreamSumAssignment.main()"); | |
| // 순차 스트림과 병렬 스트림 비교 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 김상희 | |
| import java.time.LocalDateTime; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.ScheduledExecutorService; | |
| import java.util.concurrent.TimeUnit; | |
| public class ExecutorAssignment { | |
| public static void main(String[] args) { | |
| ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2); |
NewerOlder