-
Notifications
You must be signed in to change notification settings - Fork 55
2주차 과제 제출합니다 #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
2주차 과제 제출합니다 #56
Changes from all commits
cc20ce1
c789112
4b63d9f
7a48394
5f4b435
a8d48e7
e2a8c7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,21 @@ | ||||||
| package racingcar; | ||||||
|
|
||||||
| import java.util.Scanner; | ||||||
| import java.io.IOException; | ||||||
| import java.util.Random; | ||||||
|
|
||||||
| public class Application { | ||||||
| public static void main(String[] args) { | ||||||
| // TODO: 프로그램 구현 | ||||||
| public static <string, try1> void main(String[] args) { | ||||||
| Scanner in = null; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 스캐너를 이렇게 작성하시면 NPE(NullPointerException)이 발생해요!
Suggested change
|
||||||
| System.out.println("자동차 이름을 적으시오 : "); | ||||||
| string cars = (string) in.next(); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 자바에서 String은 소문자로 적으시면 안돼요! 대소문자 구분이 확실해야 한답니다
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
| System.out.println("자동차 이름을 적으시오 : "); | ||||||
| string cars2 = (string) in.next(); | ||||||
| System.out.println("자동차 이름을 적으시오 : "); | ||||||
| string cars3 = (string) in.next(); | ||||||
|
|
||||||
| System.out.println("이동 횟수를 적으시오 : "); | ||||||
| try1 try1 = (try1) in.next(); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try1이라는 변수를 통해서 "정수"를 받고 싶으셨던 거 같아요.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
| }r | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. r은 지워주셔야해요!! |
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package racingcar; | ||
|
|
||
| import java.util.Random; | ||
| import java.util.Scanner; | ||
|
|
||
| public class carcenter { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 자바에서 클래스나 메소드 네이밍은 카멜케이스를 이용해요! |
||
| private Scanner in; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 위와 동일하게 Scanner를 선언해주셨네요. 이렇게 선언하면 어떤 문제가 생길까요? |
||
| int cars = in.nextInt(); | ||
| System.out.println() | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package racingcar; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| public class run { | ||
| public static void main(String[] args) throws IOException { | ||
| System.out.println("-" + (int)(Math.random() * 9)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 코드에서 의도하시고 싶으셨던 부분은 자동차의 움직임을 -로 나타내는 것이셨던 것 같은데, 이렇게 코드를 실행하면 코드가 어떻게 출력될까요? |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package racingcar; | ||
|
|
||
| import java.util.Scanner; | ||
|
|
||
| public class scanner { | ||
| public static void main(String[] args) { | ||
| Scanner scanner = new Scanner(System.in); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scanner 클래스는 이렇게 만들어주시지 않으셔도, 자바에서 제공하는 클래스에요! |
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| package racingcar; | ||
|
|
||
| public class winner { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 진행중이셨군요👀 |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
자바에서 메인은 제공하는 psvm(
public static void main(String[] args))로 서술해주셔야해요!psvm은 무엇일까?