Skip to content

Conversation

ZinYan
Copy link

@ZinYan ZinYan commented Oct 4, 2025

1단계 - 홈 화면
2단계 - 예약 조회

Copy link

@juanxiu juanxiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

미션하느라 고생하셨습니다~ 전체적으로 잘 구성하신 것 같아요. 리뷰에 답변 달아주세요!

package roomescape;


public record Reservation(long id, String name, String date, String time) {} No newline at end of file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자바엔 long과 Long 타입이 있습니다. 이 글 을 참고하여 둘의 차이점과 각각 어느 때에 쓰이는지 알아보면 좋을 것 같습니다.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자바엔 long과 Long 타입이 있습니다. 이 글 을 참고하여 둘의 차이점과 각각 어느 때에 쓰이는지 알아보면 좋을 것 같습니다.

감사합니다!! 찾아 봤는데 long은 저희가 늘 쓰는 primitive type이라 int의 범위를 초과하는 숫자를 다룰 때 쓰고, Long은 long을 객체 형태로 감싼 wrapper 클래스라서 다양한 메서드(parseLong())등을 사용하고 싶을 때 쓰는것 같습니다.

package roomescape;


public record Reservation(long id, String name, String date, String time) {} No newline at end of file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

record 를 사용하셨네요! class 와 record 의 차이점이 무엇인가요? record를 사용하면 장점이 무엇인가요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class는 저희가 일반적으로 사용하는 data와 operations모두 가질 수 있고, 생성자, getter등은 직접 구현해야되는데 record 같은 경우에는 스프링을 배울 때 처음 알았던 불변 data 저장 할 수 있는 기능인데 생성자, getter등을 자동으로 생성해줘서 더 간결해진다는 장점이 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants