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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

## 스터디 팀원

| [정은](https://github.com/kswkm) | [준환](https://github.com/alpaca07) |[준혁](https://github.com/jun-hY) |
|:------------:|:------------------------------------------:|:-------------------------------------------------------|
| [정은](https://github.com/kswkm) | [준환](https://github.com/alpaca07) | [준혁](https://github.com/jun-hY) |
|:------------:|:------------------------------------------:|:-------------------------------------------------------:|
| [<img src="https://github.com/kswkm.png" width="150px">](https://github.com/kswkm) | [<img src="https://github.com/alpaca07.png" width="150px">](https://github.com/alpaca07) | [<img src="https://github.com/jun-hY.png" width="150px">](https://github.com/jun-hY) |


Expand Down
58 changes: 58 additions & 0 deletions 준혁/chapter_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## 5. 클래스와 객체 1
### 05-1 객체 지향 프로그래밍과 클래스
- 객체 지향 프로그래밍 - 자바에선 클래스를 기반으로 하는 프로그래밍하는 것.
- 클래스 - 자바에서의 객체

![](./img/Pasted%20image%2020250428213007.png)

### 05-2 클래스 살펴보기
- 멤버 변수
- 메서드 - 기능 구현
### 05-3 메서드
- 메서드는 함수의 한 종류

![](./img/Pasted%20image%2020250428213502.png)
### 05-3 메서드
- 메서드는 함수의 한 종류

![](./img/Pasted%20image%2020250428213804.png)

함수명 앞에 정의된 반환형에 따라 return 예약어로 반환될 값의 타입이 정해짐

> void 형에서 함수의 동작을 종료(또는 탈출)할 목적으로 사용되는 return에는 뒤에 반환값이 붙지 않아도 됩니다.

- 함수의 호출과 값 반환

![](./img/Pasted%20image%2020250428214417.png)

> 함수를 만들어 사용함으로 불필요한 코드의 작성을 줄이고 반복적으로 사용되는 기능을 재사용할 수 있다.

## 05-4 클래스와 인스턴스
- new 예약어
해당 예약어를 통해 새로운 인스턴스를 생성

![](./img/Pasted%20image%2020250428215309.png)

- 인스턴스
클래스의 설계를 기반으로 만들어진 객체
생성된 인스턴스는 스택에 저장되고 이 인스턴스는 heap 메모리를 가리키는 포인터임.
### 05-5 생성자
- Constructor
- 생성자 오버로드
생성자가 두개 이상 제공되는 것을 뜻함
### 05-6 참조 자료형

![](./img/Pasted%20image%2020250428215726.png)

- 생성자 오버로드
생성자가 두개 이상 제공되는 것을 뜻함

![](./img/Pasted%20image%2020250428220018.png)

### 05-6 참조 자료형

![](./img/Pasted%20image%2020250428220943.png)

![](./img/Pasted%20image%2020250428220952.png)

class 를 이용한 객체형 자료형
32 changes: 32 additions & 0 deletions 준혁/chapter_4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## 6. 클래스와 객체 2
### 06-1 this 예약어
- 자신의 인스턴스를 가리킴

![](./img/chapter_4.png)

![](./img/chapter_4-1.png)

### 06-2 객체 간 협력
Student 객체에서 Bus, Subway 객체의 사용(협력)

![](./img/chapter_4-2.png)

![](./img/chapter_4-3.png)

메인 함수 작성 예시

### 06-3 static 변수
- 여러 클래스에서 사용가능한 '전역' 변수 개념
- 프로그램 시작과 함께 메모리에 작성되기에 정적 변수라고 불린다.

![](./img/chapter_4-4.png)

### 06-4 변수 유효 범위
- 지역 변수 - 함수 내부에서 유효
- 멤버 변수 - 클래스 내부 어느 메소드에서나 유효
- static 변수 - private 변수가 아니라면 어떤 클래스에서든 유효

### 06-5 static 유효 - 싱글톤 패턴
- 하나의 인스턴스만 생성하여 사용하는 디자인 패턴

![](./img/chapter_4-5.png)
43 changes: 43 additions & 0 deletions 준혁/chapter_5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## 7. 배열과 ArrayList
### 07-1 배열이란
자료형을 나열한 것?

- 선언

![](./img/chapter_5.png)

- 초기화

![](./img/chapter_5-1.png)

![](./img/chapter_5-2.png)

- 사용
인덱스는 0번부터

![](./img/chapter_5-3.png)

### 07-2 다차원 배열
![](./img/chapter_5-4.png)

- 3차원 배열

![](./img/chapter_5-5.png)

### 07-3 ArrayList 클래스
길이 변경 및 요소 위치 변경 등 편리성을 추가함

- 메서드
- add(e)
- size()
- get(int index)
- remove(int index)
- isEmpty()

- 선언

![](./img/chapter_5-6.png)

![](./img/chapter_5-7.png)

### 07-4 배열 응용 프로그램
92 changes: 92 additions & 0 deletions 준혁/chapter_6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
## 8. 상속과 다형성
### 08-1 상속이란?
기존 클래스가 새로운 클래스에게 멤버 변수와 메서드 등을 물려주는 것.

![](./img/chapter_6.png)

상속 받을 클래스에서 extends 부모 클래스 를 뒤에 붙여 사용

### 08-2 상속에서 클래스 생성과 형 변환
![](./img/chapter_6-1.png)

예제 코드.

실행 결과
```bash
부모 클래스 생성자 호출
자식 클래스 생성자 호출
```

`super()` 예약어.

자식 클래스의 생성자를 호출할 때 `super()` 예약어를 자동적으로 호출함. 해당 예약어를 사용하여 부모 클래스의 다른 생성자를 사용할 수 있음.

![](./img/chapter_6-2.png)

예제 코드.

실행 결과
```bash
num1, num2 생성자 호출
자식 클래스에서 부모 클래스의 (num1, num2) 생성자 호출
```

업캐스팅

![](./img/chapter_6-3.png)

하위 클래스(자식)를 생성해 상위 클래스(부모)로 형 변환

![](./img/chapter_6-4.png)

업캐스팅한 객체를 다시 하위 클래스(자식)로 형 변환하는 것을 다운캐스팅이라고 한다.

### 08-3 메서드 오버라이딩
![](./img/chapter_6-5.png)

부모 클래스에 메서드 추가.

![](./img/chapter_6-6.png)

자식 클래스의 오버라이딩

![](./img/chapter_6-7.png)

메인 함수 코드.

실행 결과
```bash
num1, num2 생성자 호출
num1, num2 생성자 호출
자식 클래스에서 부모 클래스의 (num1, num2) 생성자 호출
4
5
2
2
```

### 08-4 다형성
하나의 코드에 여러 자료형이 구현되어 실행되는 것.

실습 코드

![](./img/chapter_6-8.png)

실행 결과
```bash
1
1
3
4
```

### 08-5 다형성 활용하기
.

### 08-6 다운 캐스팅과 instanceof
- instanceof
상위 클래스로 형 변환된 인스턴스의 원래 자료형을 확인하는 예약어

![](./img/chapter_6-10.png)

`if (child instanceof Child)` 를 사용하여 자료형을 검사하고 `True` 이면 다운 캐스팅
46 changes: 46 additions & 0 deletions 준혁/chapter_7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## 9. 추상 클래스
### 09-1 추상 클래스

추상 클래스의 선언과 추상 메서드의 선언

![](./img/chapter_7.png)

추상 클래스의 상속

![](./img/chapter_7-1.png)

### 09-2 템플릿 메서드

템플릿 메서드의 구현

![](./img/chapter_7-2.png)

템플릿 메서드의 사용

![](./img/chapter_7-3.png)

메서드의 실행 순서(로직 흐름)를 정의하는 역할로 사용

하위 클래스(상속 받은 자식 클래스) 에서 필요한 기능을 정의해서 사용 가능

### 09-3 템플릿 메서드 응용하기

추상 클래스 정의

![](./img/chapter_7-4.png)

추상 클래스 상속

![](./img/chapter_7-5.png)

다형성 클래스 정의

![](./img/chapter_7-6.png)

### 09-4 final 예약어

final은 상수를 뜻 함

final 예약어를 사용한 클래스, 메서드, 변수를 변경 불가능

여러 파일에서 공유하는 상수를 미리 정의할 때 final 클래스에 멤버 변수로 정의해 사용할 수도 있다.
43 changes: 43 additions & 0 deletions 준혁/chapter_8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## 10. 인터페이스
### 10-1 인터페이스란?

- 클래스 혹은 프로그램이 제공하는 기능을 명시적으로 선언하는 역할
- 추상 클래스와 상수로만 이루어짐
- 구현없이 명시적으로 선언만 함

![](./img/chapter_8.png)

인터페이스를 클래스로 구현할 때 추상 클래스를 상속받는 것과 마찬가지로 모든 추상 메서드를 구현해야하며 `extends` 가 아닌 `implements` 를 통해 구현한다.

![](./img/chapter_8-1.png)

### 10-2 인터페이스와 다형성

### 10-3 인터페이스 요소
- 인터페이스 상수
인터페이스에서 선언되는 변수는 모두 상수로 컴파일된다.
- 디폴트 메서드
인터페이스에서 기능 구현 코드가 작성된 메서드, `default`
예약어 사용, `@override` 어노테이션을 활용해 재정의 가능

![](./img/chapter_8-2.png)
- 정적 메서드
`static` 예약어를 사용해 클래스의 생성과 무관하게 사용할 수 있음 `[interface 명].[method 명]` 으로 사용

![](./img/chapter_8-3.png)

![](./img/chapter_8-4.png)
- private 메서드
인터페이스 구현 클래스에서 사용하거나 재정의 불가능,

![](./img/chapter_8-5.png)

### 10-4 인터페이스 활용하기

기능 별 인터페이스 구현 후 클래스에 상속

![](./img/chapter_8-6.png)

인터페이스 간의 상속은 `extends` 예약어를 사용함

실무 사용 예시, DB 연결용 인터페이스 구현
Binary file added 준혁/img/Pasted image 20250428213007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428213502.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428213804.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428214417.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428215309.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428215726.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428220018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428220943.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/Pasted image 20250428220952.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_4-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_4-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_4-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_4-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_6-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 준혁/img/chapter_6-2.png
Binary file added 준혁/img/chapter_6-3.png
Binary file added 준혁/img/chapter_6-4.png
Binary file added 준혁/img/chapter_6-5.png
Binary file added 준혁/img/chapter_6-6.png
Binary file added 준혁/img/chapter_6-7.png
Binary file added 준혁/img/chapter_6-8.png
Binary file added 준혁/img/chapter_6-9.png
Binary file added 준혁/img/chapter_6.png
Binary file added 준혁/img/chapter_7-1.png
Binary file added 준혁/img/chapter_7-2.png
Binary file added 준혁/img/chapter_7-3.png
Binary file added 준혁/img/chapter_7-4.png
Binary file added 준혁/img/chapter_7-5.png
Binary file added 준혁/img/chapter_7-6.png
Binary file added 준혁/img/chapter_7.png
Binary file added 준혁/img/chapter_8-1.png
Binary file added 준혁/img/chapter_8-2.png
Binary file added 준혁/img/chapter_8-3.png
Binary file added 준혁/img/chapter_8-4.png
Binary file added 준혁/img/chapter_8-5.png
Binary file added 준혁/img/chapter_8-6.png
Binary file added 준혁/img/chapter_8.png