Skip to content

Commit

Permalink
[chore] 코드 수정
Browse files Browse the repository at this point in the history
- 새로운 변수 선언이 아닌 원래 변수에 대입하여 원하는 동작이 되도록 한다.
- 외부에서 사용하지 않는 메소드 private로 선언
- 선언, 할당 후 변하지 않는 함수 final 선언
  • Loading branch information
mia2583 committed Jan 3, 2023
1 parent 2befb57 commit 9acd60f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion baseball_game/src/main/java/Game/Answer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class Answer {
private int answerNumber;
private static Random random = new Random();
private final static Random random = new Random();
Answer() {
makeRandomNumber();
}
Expand Down
4 changes: 2 additions & 2 deletions baseball_game/src/main/java/Game/Input.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public int getInputNumber() {
}

public static void getInput() {
int inputNumber = validInput(scanner.next());
inputNumber = validInput(scanner.next());
}

public static int validInput(String in) {
private static int validInput(String in) {
try {
int num = Integer.parseInt(in);
return num;
Expand Down

0 comments on commit 9acd60f

Please sign in to comment.