This repository was archived by the owner on Aug 6, 2024. It is now read-only.
Open
Conversation
k0000k
reviewed
May 25, 2023
| return speed; | ||
| } | ||
|
|
||
| public int getMove() { |
k0000k
reviewed
May 25, 2023
| return move; | ||
| } | ||
|
|
||
| public void setMove(int move) { |
k0000k
reviewed
May 25, 2023
| } | ||
|
|
||
| class SuperCar extends Car { | ||
| private long seed = System.currentTimeMillis(); |
Member
There was a problem hiding this comment.
seed는 random 객체를 초기화할때 단 한번만 사용되므로, 클래스의 멤버일 필요가 없습니다. 생성자 내부에서 로컬 변수로 선언한 뒤 Random을 만들때만 사용하면 됩니다.
k0000k
reviewed
May 25, 2023
| class SuperCar extends Car { | ||
| private long seed = System.currentTimeMillis(); | ||
| private Random random = new Random(seed); | ||
| private Random random2 = new Random(seed); |
Member
There was a problem hiding this comment.
random의 seed가 현재시간이므로 객체를 하나만 만들어서 사용해도 됩니다. 2개를 만드는건 비효율적입니다.
k0000k
reviewed
May 25, 2023
| protected int move; | ||
| protected int second; | ||
|
|
||
| public Car() { |
Member
There was a problem hiding this comment.
기본생성자를 만들지 않고 super car 클래스에서 바로 super로 car의 생성자를 호출해주세요
Member
|
코멘트 확인 후 수정 바랍니다. 이해되지 않는 부분이 있다면 언제든 질문 해주세요~ |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.