Skip to content
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

[1주차] 기본 과제 & 심화 과제 제출 #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

ddongseop
Copy link
Member

@ddongseop ddongseop commented Apr 18, 2023

4/18 21:08 기준 기본 과제만 완료한 상태이며, 심화 과제도 제출할 계획입니다!
4/21 17:16 기준 심화과제 (객체지향 개념을 활용한 은행 프로그램 만들기) 완료하였습니다!

Copy link
Member

@jiyeoon00 jiyeoon00 left a comment

Choose a reason for hiding this comment

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

접근 지정자 부분까지 다 코드로 구현하셨네요👍부족했던 부분 채우고 갑니당

public String bottleColor;

public void tornado() {
System.out.println("소주는 회오리 한다음 먹어야 제맛이지! 휘이이잉!");
Copy link
Member

Choose a reason for hiding this comment

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

코드에서 술냄새나요...😒

Copy link
Member Author

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋ저날따라 술이 먹고싶었나봐요

String string2 = "빅맥";
System.out.println("// 생성자를 이용하지 않으면 같은 메모리 할당 받음");
System.out.println(System.identityHashCode(string1)); //818403870
System.out.println(System.identityHashCode(string2)); //818403870
Copy link
Member

Choose a reason for hiding this comment

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

여기서 string은 참조타입인데 왜 같은 메모리지? 하고 좀 헷갈려서 찾아보니까 자바에서는 string선언 방식이

1. new 연산자를 이용한 문자열 생성 방식
2. 문자열 리터럴 생성 방식

2개가 있군요..?! 후자에서는 String Constant Pool에 저장되고 만약 이미 존재하는 문자열이라면 같은 주소값을 공유한다고 하네요..🧐

++String Constant Pool이란❓ Heap영역 안에 위치하여 string을 별도로 관리하는 장소라고 하네유

Copy link
Member Author

Choose a reason for hiding this comment

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

우와... 이건 몰랐네요! 이런 간단해보이는 코드에서도 은근 배울게 많은 것 같아요

Copy link

@YuSuhwa-ve YuSuhwa-ve left a comment

Choose a reason for hiding this comment

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

정성 가득한 기본과제 잘 봤어요~!
심화과제는... 나중에 추가하면 말해주세요...(사실 저도 아직 안함...)

package examples;

public abstract class Alcohol {
public int ABV; //술 도수

Choose a reason for hiding this comment

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

오오 실습코드를 전부 새로하다니..!
멋지다!~!

ProtectedData protectedData = new ProtectedData();

public ProtectedChild() {
System.out.println("protected 접근 지정자 (자식 클래스에서): " + protectedData.data);

Choose a reason for hiding this comment

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

접근 지정자 실습도 일일히 했군요!

System.out.println("(오버라이딩 전) ");
food1.speak();
System.out.println("(오버라이딩 후) ");
chicken.speak();

Choose a reason for hiding this comment

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

오 이 메인메소드만 실행하면 지금까지 정리한 것들이 한번에 나오게 했네요~ 좋은것같아요

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

Successfully merging this pull request may close these issues.

3 participants