while(1) work();
반응형
article thumbnail
Postman proxy HTTPS 요청 가로채기
버그와 삽질 2023. 3. 15. 18:17

개요 Postman에는 프록시 서버를 만들어 모든 네트워크 HTTP/HTTPS 요청을 가로채 분석할 수 있다. 다만 HTTPS 처리를 위해서는 특별한 설정이 필요하다. https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-https-traffic/ Capturing HTTPS traffic | Postman Learning Center Capturing HTTPS traffic: documentation for Postman, the collaboration platform for API development. Create better APIs—faster. learning.postman.com 원리 1. 브..

이상하고 아름다운 JAVA 퀴즈 5
언어/JAVA 2023. 3. 13. 16:37

문제 class Q5 { static Integer value = 0; public static void main(String[] args) throws InterruptedException{ Runnable r = () -> { for (int i = 0; i < 100000; i++) { synchronized (value) { value++; } } }; Thread t1 = new Thread(r); Thread t2 = new Thread(r); t1.start(); t2.start(); t1.join(); t2.join(); System.out.println("value = " + value); } } 이 출력값은 200000인가? Hint: 문제 2번과 유사하다. ( https://blog...

article thumbnail
이상하고 아름다운 JAVA 퀴즈 4
언어/JAVA 2023. 3. 13. 15:04

문제A class Q4 { static { System.out.println("1"); } public static void main(String[] args) { System.out.println("2"); } static class SubQ4 { static { System.out.println("3"); } } } 출력값은 무엇인가? 문제 B class Q4 { static { System.out.println("1"); } public static void main(String[] args) { System.out.println("2"); SubQ4.value++; } static class SubQ4 { private static int value = 123; static { System.out..

article thumbnail
이상하고 아름다운 JAVA 퀴즈 3
언어/JAVA 2023. 3. 13. 01:30

문제 class Q3 { public static void main(String[] args) { Integer a = 200; Integer b = 200; System.out.println(a == b); Integer c = 100; Integer d = 100; System.out.println(c == d); } } 출력값은 무엇인가? (1) true true (2) false false (3) true false (4) false true (5) 런타임 에러 (6) 컴파일 에러 정답 답은 4번. false true 이다. Integer은 객체 래퍼(wrapper) 타입이기 때문에 두 객체는 동등성(equality)은 일치하지만 동일성(identity)은 달라야 할 것 처럼 보인다. 따라서 fa..

article thumbnail
이상하고 아름다운 JAVA 퀴즈 2
언어/JAVA 2023. 3. 13. 01:12

문제 class Q2 { static long value; public static void main(String[] args) { Runnable r = () -> { for (int i = 0; i < 100000; i++) value++; }; Thread t1 = new Thread(r); Thread t2 = new Thread(r); t1.start(); t2.start(); t1.join(); t2.join(); //작업 종료 대기 System.out.println("value = " + value); } } 출력된 값은 200000인가? 정답 아니다. 200000에 한참 못미치는 값이 출력된다. 꼬리 문제 그럼, 문제 1( https://engine-it.tistory.com/179 ) 처..

article thumbnail
이상하고 아름다운 JAVA 퀴즈 1
언어/JAVA 2023. 3. 13. 00:37

문제 class Q1 { static long value = 123456789123456789L; public static void main(String[] args) { Thread t1 = new Thread(() -> { long cnt = 0; while (true) { value = (cnt++ % 2 == 0) ? 987654321987654321L : 123456789123456789L; } }); Thread t2 = new Thread(() ->{ while (true) { long v = value; if (v != 987654321987654321L && v != 123456789123456789L) { //여기 System.out.println("Something wrong.. va..

디자인 패턴 잘 정리된 사이트
기타/링크 2023. 3. 9. 22:12

https://refactoring.guru/ko/design-patterns 디자인 패턴들 refactoring.guru 번역체가 있지만, 구체적인 예시와 인터렉션이 흥미로움

SOLID 원칙과 구체적인 예시
언어/JAVA 2023. 3. 9. 18:46

개요 아래 내용은 Chat GPT가 작성한 내용입니다. 따라서 잘못된 내용이 있을 수 있습니다....가 아니라 많네요 보니까 ^^; Chat GPT 테스트 겸 그대로 업로드합니다 SOLID 원칙 단일 책임 원칙 (Single Responsibility Principle) : 모든 클래스는 하나의 책임만 가져야 합니다. 이는 클래스를 변경할 때 다른 기능에 영향을 미치지 않도록 하는 것을 의미합니다. 개방 폐쇄 원칙 (Open-Closed Principle) : 소프트웨어 개체(클래스, 모듈, 함수 등)는 확장에 대해 열려 있어야 하고 변경에 대해서는 닫혀 있어야 합니다. 즉, 기존 코드를 변경하지 않고 새로운 기능을 추가할 수 있어야 합니다. 리스코프 치환 원칙 (Liskov Substitution Pr..

반응형

검색 태그