-
Notifications
You must be signed in to change notification settings - Fork 0
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
Solved: Practice 3~4 #15
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dad571e
solved:Chapter3-1
stopmin da0b250
solved:Chapter3-2
stopmin cc66070
solved:Chapter3-3
stopmin 6a0d992
solved:Chapter3-4
stopmin f332317
solved:Chapter3-6
stopmin b7eb57f
solved:Chapter3-7
stopmin fb0c837
solved:Chapter3-8
stopmin 2a8bb45
solved:Chapter3-9
stopmin 8907d50
solved:Chapter3-10
stopmin 7479106
solved:Chapter4-1
stopmin 2bb3f15
solved:Chapter4-3
stopmin af00ed9
solved:Chapter4-4
stopmin fc0eaa4
solved:Chapter4-5
stopmin 4d1a7b9
Merge branch 'main' into practice01-stopmin
shkisme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package Practice.stopmin; | ||
|
||
public enum Coffeetype { | ||
AMERICANO, | ||
ICE_AMERICANO, | ||
CAFE_LATTE; | ||
public static void main(String[] args) { | ||
System.out.println(AMERICANO); | ||
for (Coffeetype type : Coffeetype.values()) { | ||
System.out.println(type); | ||
} | ||
} | ||
}; | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package Practice.stopmin; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class FinalPractice { | ||
|
||
public static void main(String[] args) { | ||
final int n = 10; | ||
|
||
final ArrayList<String> a = new ArrayList<>(); | ||
|
||
a.add("hello~"); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package Practice.stopmin; | ||
|
||
public class HelloWorld { | ||
|
||
public static void main(String[] args) { | ||
System.out.println("Hello World!"); // 표준 출력 | ||
System.err.println("Error!"); // 표준 에러 출력 | ||
System.out.println("숫자" + 3 + "~~~"); | ||
|
||
Sample sample = new Sample("EE"); | ||
sample.myPublic(); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package Practice.stopmin; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
|
||
public class ListPractice { | ||
|
||
public static void main(String[] args) { | ||
ArrayList pitches = new ArrayList(); | ||
pitches.add("123"); | ||
pitches.add("312"); | ||
pitches.add("213"); | ||
System.out.println(pitches); | ||
|
||
System.out.println("pitches.get(1) = " + pitches.get(1)); | ||
System.out.println("pitches.size() = " + pitches.size()); | ||
|
||
pitches.sort(Comparator.naturalOrder()); | ||
System.out.println(pitches); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package Practice.stopmin; | ||
|
||
public class NumberPractice { | ||
|
||
public static void main(String[] args) { | ||
int age = 21; | ||
long count = 102938901283012093L; | ||
|
||
age += 10; | ||
|
||
boolean isTest = true; // is~, has~, can~ | ||
|
||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package Practice.stopmin; | ||
|
||
public class Sample { | ||
|
||
|
||
private String message; // 속성, 필드 | ||
|
||
public Sample(String message) { | ||
this.message = message; | ||
} | ||
|
||
public static void main(String[] args) { | ||
Sample sample = new Sample("ABDERERER"); | ||
} | ||
|
||
public void myPublic() { | ||
System.out.println(message); | ||
} | ||
|
||
protected void myP() { | ||
|
||
} | ||
|
||
private void myP2() { | ||
|
||
} | ||
|
||
void myD() { | ||
|
||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package Practice.stopmin; | ||
|
||
public class StringPractice { | ||
|
||
public static void main(String[] args) { | ||
String a = "Happy"; // 리터럴 방식 | ||
String b = new String("Java"); // 객체 생성 | ||
|
||
System.out.println("a.eqauls(b) = " + a.equals(b)); | ||
|
||
boolean c = true; // 프리미티브 -> Null을 담을 수 없다. 대신 string은 안된다!! | ||
Boolean e = true; // 레퍼클래스 | ||
|
||
e = null; | ||
|
||
int f = 10; | ||
Integer g = 10; | ||
|
||
g = null; | ||
|
||
a.equals(b); | ||
|
||
// indexOf | ||
// contains | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
이 코드 패치에는 주민등록번호를 처리하는 부분이 포함되어 있습니다. 리뷰 결과와 개선 제안을 아래에서 안내합니다:
substring()
을 사용하여 주민등록번호를 원하는 형식으로 분리하는 점은 효과적입니다.그러나 코드 패치에는 오류가 있습니다.
personNumber.substring(8, 14)
라인에서 인덱스 범위가 잘못되었습니다. 주민등록번호의 뒷자리 숫자는 인덱스 6부터 시작하는데, 해당 값을 출력하기 위해personNumber.substring(8, 14)
대신에personNumber.substring(7)
을 사용해야 합니다.개선된 코드 프래그먼트는 다음과 같습니다:
이제 주어진 주민등록번호를 연월일과 뒷자리 숫자로 올바르게 나눈 후 출력할 수 있습니다.