Conversation
joona95
approved these changes
Feb 14, 2026
| > 이 과정에서 **변하지 않는 것**(JDBC 작업 흐름, try/catch/finally)과 **변하는 것**(PreparedStatement 생성)의 분리라는 원칙은 계속 유지된다. 달라지는 것은 전략을 정의하고 전달하는 방식이 점점 간결해진다는 것이다. 이 구조는 이후 **템플릿/콜백 패턴**의 기초가 된다. | ||
|
|
||
| ## 질문 | ||
| - 로컬 클래스에서 외부 변수를 참조할 때 `final`로 선언해야 하는 이유는 무엇인가? |
Contributor
There was a problem hiding this comment.
Q. 로컬 클래스에서 외부 변수를 참조할 때 final로 선언해야 하는 이유는 무엇인가?
- 내부 클래스는 바깥 메서드의 지역 변수를 직접 참조하는 것이 아니라 복사된 값을 사용하기 때문에 변경 가능한 변수는 허용하지 않습니다. Java 7 까지는
final선언을 명시적으로 해줘야 했으나, Java 8 부터는 선언하지 않아도 되지만 사실상final인 값이어야만 합니다.
|
|
||
| ## 질문 | ||
| - 로컬 클래스에서 외부 변수를 참조할 때 `final`로 선언해야 하는 이유는 무엇인가? | ||
| - 익명 내부 클래스 방식과 독립된 전략 클래스 방식은 각각 어떤 경우에 적합한가? |
Contributor
There was a problem hiding this comment.
Q. 익명 내부 클래스 방식과 독립된 전략 클래스 방식은 각각 어떤 경우에 적합한가?
- 전략이 한 번만 사용되고 마는 경우에는 익명 내부 클래스 방식이 적합하지만, 전략이 여러 곳에서 재사용되는 경우에는 독립된 전략 클래스 방식이 더 적합합니다.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closed #28
🙆🏻 내용을 이해하기 쉽고 정확하게 작성하였는가?
📚 글 하단에 예상질문, 참고자료를 포함시켰는가?
🔖 라벨은 등록했는가?
✅ 이슈는 닫았는가?