Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions 준환/chapter06.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

## 🌅 공부기록
1. this 예약어
2. 객체 간 협력
3. static 변수
4. 변수 유효 범위
5. static 응용 - 싱글톤 패턴
### 🧠 배운 점
- this : 생성된 인스턴스 스스로를 가르키는 예약어
- this 출력하기
- ![image](https://github.com/user-attachments/assets/584c5b29-db10-4e5e-bfd1-08b030993deb)
- ![image](https://github.com/user-attachments/assets/e6935719-46ae-4f38-8bda-71060e4259ca)
- this로 다른 생성자 호출하기
- ![image](https://github.com/user-attachments/assets/26e36732-baeb-4fd2-ba49-989195294dd3)
- ![image](https://github.com/user-attachments/assets/66445622-8787-4ffe-8092-fc2c009cbcb0)
- this를 사용하여 주소 값 반환하기
- ![image](https://github.com/user-attachments/assets/0beee8b9-7072-4f59-b1e6-5ebdfae6936a)
- ![image](https://github.com/user-attachments/assets/7693e78d-94e6-43d7-9bd4-6fab44504c9a)
- 객체 지향 프로그램은 객체를 정의 하고 객체 간 협력으로 만들어 진다고 했다
- ex) ![image](https://github.com/user-attachments/assets/fd09f943-adfa-42ba-a580-0e9a289d6325)
- 학생 클래스 구현
- ![image](https://github.com/user-attachments/assets/67e5a1d2-d781-49c2-a762-b940b5a04e47)
- 버스 클래스 구현
- ![image](https://github.com/user-attachments/assets/5885083f-01a4-442f-b07d-5510c29c6d52)
- 지하철 클래스 구현
- ![image](https://github.com/user-attachments/assets/79692f53-e370-4d2b-9b73-56e12388eeae)
- 버스와 지하철 타기
- ![image](https://github.com/user-attachments/assets/41fa3b5f-2840-4c94-9498-e1ae50857096)
- ![image](https://github.com/user-attachments/assets/025d1611-e1d7-459c-8243-ca52b20567ad)
- static 변수 : 클래스에서 공통으로 사용하는 변수
- static 변수 사용하기
- ![image](https://github.com/user-attachments/assets/b6610d1e-f807-43df-a922-cf5ab879bfe3)
- 변수 테스트 하기
- ![image](https://github.com/user-attachments/assets/2c751c62-9b7b-43ba-b1a1-ef9ec7b33425)
- ![image](https://github.com/user-attachments/assets/f13bfa10-1c1e-415e-8bc3-90e5d6410646)
- 클래스 이름으로 static 변수 참조하기
- ![image](https://github.com/user-attachments/assets/af656a11-a19b-4334-89b4-e9c3d203a792)
- ![image](https://github.com/user-attachments/assets/da71ff0b-1276-4647-a39b-20bb40bf091b)
- seriaNum의 get(),set() 메서드 사용하기
- ![image](https://github.com/user-attachments/assets/d902ab83-62e9-4e87-b728-32a365143b38)
- 변수 유효 범위
- ![image](https://github.com/user-attachments/assets/803c0a3b-4fb4-47bc-aba6-d517ef697a94)
- 싱글톤 패턴
- 객체 지향 프로그램에서 인스턴스를 단 하나만 생성하는 디자인 패턴
- 싱글톤 패턴으로 회사 클래스 구현하기
- 1단계 생성자를 private으로 만들기
- ![image](https://github.com/user-attachments/assets/96b0e174-d6bc-4aa4-9ae5-a42a353dc6c6)
- 2단계 static으로 유일 인스턴스 생성
- ![image](https://github.com/user-attachments/assets/e9c4f9b8-7278-4997-b299-dcd0cbcc716d)
- 3단계 외부에서 참조할 수 있는 public 메서드 만들기
- ![image](https://github.com/user-attachments/assets/f908eb3e-7e63-47c0-ba6f-22b45b286381)
- 4단계 실제로 사용하는 코드 만들기
- ![image](https://github.com/user-attachments/assets/cd0dd064-f765-4a97-ab21-e3fea554f62a)

24 changes: 24 additions & 0 deletions 준환/chapter07.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

## 🌅 공부기록
1. 배열이란
2. 다차원 배열
3. ArrayList 클래스 사용하기
4. 배열 응용 프로그램
### 🧠 배운 점
- 배열 초기화 하고 출력하기
- ![image](https://github.com/user-attachments/assets/7f461faf-aadc-40af-bd6f-28bd936f1ba9)
- ![image](https://github.com/user-attachments/assets/df80d09f-e43e-41cc-8abe-39b6afbad0cc)
- 배열 길이만큼 출력하기
- ![image](https://github.com/user-attachments/assets/c51a594e-abcd-4b83-9362-88926a071dcf)
- 배열의 유효한 요소 값 출력하기
- ![image](https://github.com/user-attachments/assets/69e68b8a-86dd-4559-b675-37326ff351cf)
- 문자 저장 배열 만들기
- ![image](https://github.com/user-attachments/assets/0a26aa89-b937-4df0-a5d2-a89817d2e24d)
- 객체 배열 사용하기
- ![image](https://github.com/user-attachments/assets/5fca6865-4030-466a-9199-acc974547fe0)
- 각 배열 요소에 인스턴스를 생성해 넣기
- ![image](https://github.com/user-attachments/assets/f8ed8189-559a-420a-8133-7973eb1a237d)
- 이차원 배열 초기화 하기
- ![image](https://github.com/user-attachments/assets/ae6627f7-7e34-4d93-8cd4-f05d5bc40758)
- ArraryList 클래스 사용하기
- ![image](https://github.com/user-attachments/assets/b733ce6f-d6cb-462e-9c0a-a3ede3bfb1b0)
144 changes: 144 additions & 0 deletions 준환/chapter08.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@


## 🌅 공부기록
1. 상속이란
2. 상속에서 클래스 생성과 형 변환
3. 메서드 오버라이딩
4. 다형성
5. 다형성 활용
6. 다운 캐스팅과 instanceof
### 🧠 배운 점
- 상속이란
- B클래스가 A클래스를 상속 받았을때 B클래스는 A클래스의 변수나 메서드를 사용이 가능하다.
- Customer 클래스 구현하기
- ![image](https://github.com/user-attachments/assets/7c266bc1-c9d9-42dd-9be4-d3f43d4b90c2)
- vip 클래스 구현하기
- ![image](https://github.com/user-attachments/assets/b54b24a0-e7c6-4d6a-8f39-15d0b3099968)
customer 코드에서 뭔가 잘못해서 그 부분만 나중에 다시 추가하겠습니다.
- 다형성이란
- 하나의 코드가 여러 자료형으로 구분되어 실행되는 것을 말한다.
- 다향성 테스트 하기
```
package chapter08.polymorphism;

class Animal {
public void move() {
System.out.println("동물이 움직입니다");
}
}

class Human extends Animal {
public void move() {
System.out.println("사람이 두 발로 걷습니다");
}
}

class Tiger extends Animal {
public void move() {
System.out.println("호랑이가 네 발로 뜁니다.");
}
}

class Eagle extends Animal {
public void move() {
System.out.println("독수리가 하늘을 납니다");
}
}

public class AnimalTest1 {
public static void main(String[] args) {
AnimalTest1 aTest = new AnimalTest1(); // 자기 자신 객체 생성
aTest.moveAnimal(new Human());
aTest.moveAnimal(new Tiger());
aTest.moveAnimal(new Eagle());
}

public void moveAnimal(Animal animal) {
animal.move();
}
}

```
![image](https://github.com/user-attachments/assets/809f2846-37de-44ce-9898-dce2da34f779)
- instanceof로 원래 인스턴스형 확인 후 다운 캐스팅 하기
'''
package chapter08.polymorphism;
import java.util.ArrayList;

class Animal {
public void move() {
System.out.println("동물이 움직입니다.");
}
}

class Human extends Animal {
public void move() {
System.out.println("사람이 두 발로 걷습니다.");
}

public void readBook() {
System.out.println("사람이 책을 읽습니다.");
}
}

class Tiger extends Animal {
public void move() {
System.out.println("호랑이가 네 발로 뜁니다.");
}

public void hunting() {
System.out.println("호랑이가 사냥을 합니다.");
}
}

class Eagle extends Animal {
public void move() {
System.out.println("독수리가 하늘을 납니다.");
}

public void flying() {
System.out.println("독수리가 날개를 쭉 펴고 멀리 날아갑니다.");
}
}
public class AnimalTest {
ArrayList<Animal> aniList = new ArrayList<Animal>(); // Animal 타입의 ArrayList 선언

public static void main(String[] args) {
AnimalTest aTest = new AnimalTest();
System.out.println("원래 융으로 다룰 캐스팅");
aTest.addAnimal();
aTest.testCasting();
}

public void addAnimal() {
aniList.add(new Human()); // Human 객체 추가
aniList.add(new Tiger()); // Tiger 객체 추가
aniList.add(new Eagle()); // Eagle 객체 추가

for (Animal ani : aniList) {
ani.move(); // 각 동물의 move 메서드 호출
}
}

public void testCasting() {
for (int i = 0; i < aniList.size(); i++) { // 모든 요소를 하나씩 돌면서
Animal ani = aniList.get(i); // Animal 타입으로 가져옴
if (ani instanceof Human) {
Human h = (Human) ani; // Human이면 캐스팅
h.readBook(); // Human의 readBook 메서드 호출
} else if (ani instanceof Tiger) {
Tiger t = (Tiger) ani; // Tiger이면 캐스팅
t.hunting(); // Tiger의 hunting 메서드 호출
} else if (ani instanceof Eagle) {
Eagle e = (Eagle) ani; // Eagle이면 캐스팅
e.flying(); // Eagle의 flying 메서드 호출
} else {
System.out.println("지원되지 않는 형입니다."); // 지원되지 않는 형일 경우
}
}
}
}

'''
- ![image](https://github.com/user-attachments/assets/889a55fc-6336-48d1-a8a8-be06c785e2b3)
-
47 changes: 47 additions & 0 deletions 준환/chapter09.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@


## 🌅 공부기록
1. 추상 클래스
2. 탬플릿 메서드
3. 템플릿 메소드 응용하기
4. final 예약어
### 🧠 배운 점
- 추상 클래스란?
- 추상 클래스는 항상 추상 메서드를 포함합니다. 추상 메서드는 구현 코드가 없습니다. 함수의 구현 코드가 없다는 것은 함수 몸체가 없다는 뜻
![image](https://github.com/user-attachments/assets/f8c82850-a8ff-4e6f-883c-af3c03d74355)
중괄호로 감싼 부분은 함수의 구현부라고 한다.
이 부분이 없는 함수는 추상 함수이고 자바에서는 추상 메서드라고 합니다.
추상메서드는 그림과 같이 선언만 하며 abstract 예약어를 사용합니다. 그리고 {} 대신에 ;를 쓴다.
![image](https://github.com/user-attachments/assets/b2a1393e-1bd9-41e5-8189-9cef5d7a6486)
- 추상 클래스 구현하기
![image](https://github.com/user-attachments/assets/e97e8182-45b2-427f-9a53-978c36cebf5e)
- 추상 메서드 구현하기
![image](https://github.com/user-attachments/assets/d88f1a8a-3a67-4342-a592-f64cb6fbc8fe)
- NoteBook 클래스 구현하기
![image](https://github.com/user-attachments/assets/799a67fe-1d38-4117-89ce-ffe274d5f710)
- MyNotebook 클래스 구현하기
![image](https://github.com/user-attachments/assets/e8c392b6-0b6a-4e1f-bc2a-7102fa1e6bc3)
- 추상 클래스 테스트 하기
![image](https://github.com/user-attachments/assets/ed7929a1-e7cb-4017-bf54-0b428abfa91e)
하지만 클래스를 인스턴스로 생성 할 수 없다고 나온다.

- 추상클래스와 템플릿 메서드
템플릿 메서드 : 틀이 있는 메서드
![image](https://github.com/user-attachments/assets/d38aae5b-0c5f-435d-aab8-c1c587285a58)
- AIcar 클래스 구현
![image](https://github.com/user-attachments/assets/2300a96f-bc06-4592-898b-aed083535dee)
- ManualCar
![image](https://github.com/user-attachments/assets/fb9927ad-e821-4c95-abd8-26671da8680f)
- 두 자동차가 어떻게 움직이는지 확인
![image](https://github.com/user-attachments/assets/b3db1d3c-cb41-43e6-8512-3b34773173fd)

playerLevel 추상 클래스 구현하기
![image](https://github.com/user-attachments/assets/c169f37b-7eac-4076-9637-47617524bf64)
초보자 레벨 클래스 구현하기
![image](https://github.com/user-attachments/assets/e07b3674-49ec-4a3f-b122-640c4b460424)
중급자
![image](https://github.com/user-attachments/assets/f7db5135-c74d-4d7e-81a6-a629793f3d23)
고급자
![image](https://github.com/user-attachments/assets/218094a1-acae-4700-815c-c0dd5c388df2)
테스트 프로그램 실행하기
![image](https://github.com/user-attachments/assets/aa0b19f9-e7bf-4b47-865b-b50aa438670b)
42 changes: 42 additions & 0 deletions 준환/chapter10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@


## 🌅 공부기록
1.인터페이스란
2. 인터페이스와 다형성
3. 인터페이스 요소 살펴보기
4. 인터페이스 활용하기
### 🧠 배운 점
인터페이스란
- 클래스 혹은 프로그램이 제공하는 기능을 명시적으로 선언하는 역할
- 추상 메서드와 상수로만 이루어져 있다.
calc 인터페이스 부분 다시해서 수정하겠습니다.
- scheduler 인터페이스 정의하기

![image](https://github.com/user-attachments/assets/ceaf39d2-bd97-4fcb-96c8-c08f96456e61)
- 순서대로 배분하기
![image](https://github.com/user-attachments/assets/99dabce0-8682-4400-a454-1c4eaa04466c)
- 짧은 대기열 먼저 배분하기
![image](https://github.com/user-attachments/assets/73dbcee1-30db-4ed1-8204-77d3097a6624)
- 우선순위에 따라 배분하기
![image](https://github.com/user-attachments/assets/402b034b-8a0a-41c6-98e6-777ccccfea4b)
- 입력 문자에 따라 배분 정책 수행하기
![image](https://github.com/user-attachments/assets/11fa8ed9-a9c4-4375-ba88-efe4d61dea2b)

![image](https://github.com/user-attachments/assets/0e196306-2bdb-4a53-9caf-c856f880b2ed)

- shelf 클래스 만들기

![image](https://github.com/user-attachments/assets/f5488a2d-2388-4dae-b85f-0db5a7cca845)
- Queue 인터페이스 정의하기

![image](https://github.com/user-attachments/assets/8618936a-fcae-44e8-8e09-76c0216663c9)
- BookShelf 클래스 구현하기

![image](https://github.com/user-attachments/assets/d9974401-88ad-430d-9b7a-18b6ebc2c90e)
- BookShelf 테스트 하기

![image](https://github.com/user-attachments/assets/f3e8860c-5b7c-4efa-8742-801f2d963ef5)
![image](https://github.com/user-attachments/assets/316f8a50-97cb-4452-9ea9-6e3fea0b8d70)



48 changes: 48 additions & 0 deletions 준환/chapter_05.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
제목 : 클래스와 객체1
-->

## 🌅 공부기록
1. 객체 지향 프로그래밍과 클래스
2. 클래스 살펴보기
3. 메서드
4. 클래스와 인스턴스
5. 생성자
6. 참조 자료형
### 🧠 배운 점
- 클래스 정의
![image](https://github.com/user-attachments/assets/e930df43-063d-402a-8fe4-4422491c243b)
- 변수 자료형
- 기본 자료형:int,long,float,double
- 참조 자료형:String, Data, Student
- ![image](https://github.com/user-attachments/assets/9f16a709-1d18-4dcd-904a-7a18a26df88d)
- 메서드 : 클래스의 기능을 구현한 것
- ![image](https://github.com/user-attachments/assets/26856059-7cc7-4bb2-8124-bc8891b22172)
- 함수 호출하고 값 반환하기
- ![image](https://github.com/user-attachments/assets/2bb1dac2-9a56-4397-99c8-ef88c6ecaeb8)
- ![image](https://github.com/user-attachments/assets/c91c6bb9-b45c-4594-8ac7-d3930c118f49)
- 메서드 구현하기
- ![image](https://github.com/user-attachments/assets/b31bfed3-daba-41bd-a365-a8418c26683b)
- 클래스에 함수 추가 하기
- ![image](https://github.com/user-attachments/assets/0a19c7ee-12a0-4f5d-b6e4-162c5e0bc068)
- ![image](https://github.com/user-attachments/assets/cf245be0-f71f-4337-8d7f-ad270f492a5d)
- 인스턴스 : 메모리 공간에 생성된 상태 -> 생성된 클래스의 인스턴스 = 객체
- 참조 값 출력하기
- ![image](https://github.com/user-attachments/assets/784b08d8-39fa-4560-9d4a-6b616eab4cf6)
- ![image](https://github.com/user-attachments/assets/3f6745af-eee9-45d9-9e65-db3daeae7879)
- 생성자 객체를 처음 만들 때 멤버 변수나 상수를 초기화하는 것
- 디폴트 생성자: 자동으로 만들어 주는 생성자
- 생성자 만들기, 생성자 테스트 하기, 사용하기, 구현하기
- ![image](https://github.com/user-attachments/assets/17b3d29b-0c64-467a-9a1b-a637af706166)
- ![image](https://github.com/user-attachments/assets/e1ddca78-45b0-40f8-9932-0ec832379d0d)
- 참조 자료형
- 클래스 자료형으로 선언하는 것
- 클래스 생성
- ![image](https://github.com/user-attachments/assets/c625e222-f954-41bd-8c6f-acee457be2f2)
- 변수 추가
- ![image](https://github.com/user-attachments/assets/964d150c-6c17-48fc-a04f-bb31318a2e45)
- Subject형을 사용하여 선언
- ![image](https://github.com/user-attachments/assets/3bfbe61d-172a-4278-bc1a-a6622b0f27b5)

-