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
/*제로베이스 BE 35기 김현승*/ | |
public class CounterWithSync { | |
static int count = 0; | |
// synchronized 메서드 사용 | |
public synchronized static void increment() { | |
count++; | |
} |
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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package javaEx; | |
public class ObserverPatternExample { | |
interface Observer { | |
void update(String 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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package javaEx; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.stream.Stream; |
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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package javaEx; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
import java.lang.annotation.ElementType; |
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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package JavaTask; | |
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.TimeUnit; |
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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package JavaTask; | |
import java.util.stream.LongStream; | |
public class ParallelStreamSumExample { |
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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package JavaTask; | |
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; |
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
/* | |
제로베이스 35기 김현승 | |
*/ | |
package JavaTask; | |
public class AuthenticationSystem { | |
private static ThreadLocal<String> userLocal = new ThreadLocal<>(); |
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 JavaTask; | |
public class ProducerConsumerExample { | |
// 공유 자원(Buffer) 클래스 | |
private static class Buffer { | |
private final int capacity; | |
private final java.util.Queue<Integer> queue = new java.util.LinkedList<>(); | |
public Buffer(int capacity) { |