본문 바로가기

국비

반응형

✅ 1. 클래스 상속 기본 (ch07.sec02)

📌 Phone → SmartPhone 클래스 상속

  • SmartPhone은 Phone의 모든 필드/메서드를 상속받음
  • this.model, this.color 직접 초기화 가능
public class SmartPhone extends Phone {
    boolean wifi;
    void setWifi(...) {...}
    void internet() {...}
}

📌 사용 예

phone.bell();  // 상속받은 메서드
phone.internet();  // SmartPhone 메서드

✅ 2. 부모 생성자 호출 (super) (ch07.sec03.exam01)

  • 부모 클래스에 매개변수 생성자만 존재할 경우, 자식 클래스에서 super(...)로 반드시 호출해야 함
public class SmartPhone extends Phone {
    public SmartPhone(String model, String color) {
        super(model, color);  // 부모 생성자 호출
    }
}
  • 출력 순서:
Phone() 생성자 실행
SmartPhone() 생성자 실행됨

✅ 3. 메서드 오버라이딩 (ch07.sec04.exam01)

📌 부모 메서드를 자식이 재정의

public class Computer extends Calculator {
    @Override
    public double areaCircle(double r) {
        return Math.PI * r * r;
    }
}
  • 부모 객체로 호출 시 → 부모 메서드 실행
  • 자식 객체로 호출 시 → 자식 메서드 실행

✅ 4. super 키워드 활용 & 비행기 예제 (ch07.sec04.exam02)

  • Airplane → SupersonicAirplane 클래스 상속
  • fly() 메서드를 오버라이딩하여 조건 분기
public void fly() {
    if (flyMode == SUPERSONIC)
        System.out.println("초음속 비행합니다.");
    else
        super.fly();  // 부모 메서드 호출
}

📌 실행 결과 예시

이륙합니다.
일반 비행합니다.
초음속 비행합니다.
일반 비행합니다.
착륙합니다.

📌 15일차 핵심 요약

개념 설명
상속 (extends) 부모 클래스의 필드와 메서드를 자식이 물려받음
super() 부모 생성자 호출 시 사용 (생성자 첫 줄 필수)
메서드 오버라이딩 부모 메서드를 자식이 재정의
super.메서드() 오버라이딩된 메서드 내부에서 부모의 원본 메서드 호출
상속 예제 스마트폰, 컴퓨터, 초음속 비행기 등 실습 포함

 

댓글
반응형

13일차 - 연습 문제 풀이를 위하여 자습

14일차 - 앞에서 수업한 내용을 한번 되짚으며 복습 진행하여 새로운 정보가 없어서 패스합니다.

댓글
반응형

✅ 오전 수업 요약

1. final 필드 (Korean 클래스)

  • final은 한 번 값이 설정되면 변경 불가
  • 생성자 또는 선언 시 초기화 가능

2. static final 상수 (Earth 클래스)

  • static final로 고정값(상수) 선언
  • 관례적으로 대문자로 작성
  • 클래스명으로 접근

3. 접근 제한자 (A, B, C 클래스)

  • public : 어디서나 접근 가능
  • (default) : 같은 패키지 내에서만 접근 가능
  • private : 클래스 내부에서만 접근 가능
  • 다른 패키지에서 default, private 접근 시 컴파일 에러

✅ 오후 수업 요약

1. Getter / Setter 메서드 (Car 클래스)

  • private 필드 값을 안전하게 다루기 위해 Getter/Setter 사용
  • 유효성 검사(예: 음수 속도 입력 시 보정) 포함
  • isStop() 메서드는 boolean형 필드 getter로 활용

✅ 자습 내용 요약

1. Member 클래스 생성 및 사용 (mission14)

package ch06.sec99.mission14;

public class Member {
	String name;
	String id;
	String password;
	int age;
	
	Member(String name, String id){
		this.name = name;
		this.id = id;
	}
}
package ch06.sec99.mission14;

public class MemberExample {
	public static void main(String[] args) {
		Member m1 = new Member("홍길동", "hong");
		
		System.out.println("name : " + m1.name + " / id : " + m1.id);
	}
}
  • name, id 필드 설정
  • 생성자를 통해 필드 초기화

2. MemberService 로그인 기능 (mission15)

package ch06.sec99.mission15;

public class MemberService {
	boolean login(String id, String password) {
		if (id.equals("hong") && password.equals("12345"))
			return true;
		else
			return false;
	}

	void logout(String id) {
		System.out.println(id + "님이 로그아웃 되었습니다");
	}
}
package ch06.sec99.mission15;

public class MemberServiceExample {
	public static void main(String[] args) {
		MemberService memberService = new MemberService();
		boolean result = memberService.login("hong", "12345");
		if (result) {
			System.out.println("로그인 되었습니다.");
			memberService.logout("hong");
		} else {
			System.out.println("id 또는 password가 올바르지 않습니다.");
		}
	}
}
  • 로그인 검증 메서드 login()
  • 로그아웃 메서드 logout()

3. Printer 클래스 (mission16, mission17)

  • instance 메서드 버전 (mission16)
package ch06.sec99.mission16;

public class Printer {
	void println(String value){
		System.out.println(value);
	}
	
	void println(int value) {
		System.out.println(value);
	}
	
	void println(boolean value) {
		System.out.println(value);
	}
	
	void println(double value) {
		System.out.println(value);
	}
}
package ch06.sec99.mission16;

public class PrinterExample {
	public static void main(String[] args) {
		Printer printer = new Printer();
		printer.println(10);
		printer.println(true);
		printer.println(5.7);
		printer.println("홍길동");
	}
}
  • static 메서드 버전 (mission17)
package ch06.sec99.mission17;

public class Printer {
	static void println(String value) {
		System.out.println(value);
	}

	static void println(int value) {
		System.out.println(value);
	}

	static void println(boolean value) {
		System.out.println(value);
	}

	static void println(double value) {
		System.out.println(value);
	}
}
package ch06.sec99.mission17;

public class PrinterExample {
	public static void main(String[] args) {
		Printer.println(10);
		Printer.println(true);
		Printer.println(5.7);
		Printer.println("홍길동");
	}
}
  • 다양한 타입(String, int, boolean, double) 출력 가능

4. ShopService 싱글톤 패턴 (mission18)

package ch06.sec99.mission18;

public class ShopService {
	private static ShopService singleton = new ShopService();
	private ShopService() {
	}
	
	public static ShopService getInstance() {
		return singleton;
	}
}
package ch06.sec99.mission18;

public class ShopServiceExample {
	public static void main(String[] args) {
		ShopService obj1 = ShopService.getInstance();
		ShopService obj2 = ShopService.getInstance();
		
		if(obj1 == obj2)
			System.out.println("같은 ShopService 객체입니다.");
		else
			System.out.println("다른 ShopService 객체입니다.");
	}
}
  • 객체를 단 하나만 생성하는 패턴
private static ShopService singleton = new ShopService();
private ShopService() { }
public static ShopService getInstance() { return singleton; }
  • == 비교로 동일 객체 확인

5. Account 클래스 (mission19)

package ch06.sec99.mission19;

public class Account {
	private int balance = 0;
	final private int MIN_BALANCE = 0;
	final private int MAX_BALANCE = 1000000;

	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		if (MIN_BALANCE <= balance && balance <= MAX_BALANCE) {
			this.balance = balance;
		}
	}
}
package ch06.sec99.mission19;

public class AccountExample {
	public static void main(String[] args) {
		Account account = new Account();
		
		account.setBalance(10000);
		System.out.println("현재 잔고 : " + account.getBalance());
		
		account.setBalance(-100);
		System.out.println("현재 잔고 : " + account.getBalance());
		
		account.setBalance(2000000);
		System.out.println("현재 잔고 : " + account.getBalance());
		
		account.setBalance(30000);
		System.out.println("현재 잔고 : " + account.getBalance());
	}
}
  • 잔액 제한 (MIN_BALANCE, MAX_BALANCE)
  • Setter에서 유효한 범위 내일 때만 설정

6. BankApplication - 계좌 관리 프로그램 (mission20)

package ch06.sec99.mission20;

public class Account {
	private String num = null;
	private String name = null;
	private int balance = 0;
	final private int MIN_BALANCE = 0;
	final private int MAX_BALANCE = 1000000;

	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		if (MIN_BALANCE <= balance && balance <= MAX_BALANCE) {
			this.balance = balance;
		}
	}
	
	public void plusBalance(int balance) {
		this.balance += balance;
	}
	
	public void minusBalance(int balance) {
		this.balance -= balance;
	}

	public String getNum() {
		return num;
	}

	public void setNum(String num) {
		this.num = num;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public static void main(String[] args) {
		
	}
}
package ch06.sec99.mission20;

import java.util.Scanner;

public class BankApplication {
	Scanner sc = new Scanner(System.in);
	Account account[] = new Account[100];

	public static void main(String[] args) {
		BankApplication ba = new BankApplication();
		ba.start();
		System.out.println("프로그램 종료");
	}

	void start() {
		String input;

		while (true) {
			System.out.println("-".repeat(50));
			System.out.println("1.계좌생성 | 2.계좌목록 | 3.예금 | 4.출금 | 5. 종료");
			System.out.println("-".repeat(50));
			System.out.print("선택> ");

			input = sc.nextLine();
			if (input.equals("1"))
				createAccount();
			else if (input.equals("2"))
				accountList();
			else if (input.equals("3"))
				moneyPlue();
			else if (input.equals("4"))
				moneyMinus();
			else
				break;

		}
	}

	void createAccount() {
		String input;
		Account acc = new Account();

		System.out.println("-".repeat(10));
		System.out.println("계좌생성");
		System.out.println("-".repeat(10));

		System.out.print("계좌번호 : ");
		input = sc.nextLine();
		acc.setNum(input);

		System.out.print("계좌주 : ");
		input = sc.nextLine();
		acc.setName(input);

		System.out.print("초기입금액 : ");
		input = sc.nextLine();
		acc.setBalance(Integer.parseInt(input));

		for (int i = 0; i < account.length; i++)
			if (account[i] == null) {
				account[i] = acc;
				break;
			}

		System.out.println("결과: 계좌가 생성되었습니다.");
	}

	void accountList() {
		System.out.println("-".repeat(10));
		System.out.println("계좌목록");
		System.out.println("-".repeat(10));

		for (int i = 0; i < account.length; i++) {
			if (account[i] == null)
				break;
			System.out.println(account[i].getNum() + "\t" + account[i].getName() + "\t" + account[i].getBalance());
		}
	}

	void moneyPlue() {
		String input;
		int money;

		System.out.println("-".repeat(10));
		System.out.println("예금");
		System.out.println("-".repeat(10));

		System.out.print("계좌번호 : ");
		input = sc.nextLine();

		for (int i = 0; i < account.length; i++)
			if (account[i] == null)
				break;
			else if (account[i].getNum().equals(input)) {
				System.out.print("예금액 : ");
				money = Integer.parseInt(sc.nextLine());
				account[i].plusBalance(money);
			}

	}

	void moneyMinus() {
		String input;
		int money;

		System.out.println("-".repeat(10));
		System.out.println("출금");
		System.out.println("-".repeat(10));

		System.out.print("계좌번호 : ");
		input = sc.nextLine();

		for (int i = 0; i < account.length; i++)
			if (account[i] == null)
				break;
			else if (account[i].getNum().equals(input)) {
				System.out.print("출금액 : ");
				money = Integer.parseInt(sc.nextLine());
				account[i].minusBalance(money);
				System.out.println("결과: 출금이 성공되었습니다.");
			}
	}
}
  • 기능:
    • 계좌 생성
    • 계좌 목록 출력
    • 예금
    • 출금
  • 계좌는 Account 배열에 저장
  • Scanner로 사용자 입력 받아 처리
  • 배열에 null 체크하여 빈 공간에 새 계좌 저장
  • 예금/출금 시 계좌번호 일치 여부 검사

📌 12일차 핵심 요약

항목 주요 내용
final 필드 한 번 초기화 후 값 변경 불가
static final 상수 클래스 로딩 시 고정, 대문자 명명
접근 제한자 public, default, private 차이 이해
Getter/Setter 필드 보호 및 안전한 값 조작
메서드 오버로딩 이름 같고 매개변수 다르게 여러 메서드 정의
싱글톤 패턴 하나의 인스턴스만 생성 및 공유
실습 프로젝트 계좌 관리 프로그램 구축 (생성, 목록, 예금, 출금)
댓글
반응형

✅ 오전 수업 요약

1. 가변 인자 메서드 (Computer 클래스)

  • int... values를 이용하여 매개변수 개수 자유롭게 받기
int sum(int... values) { 
    for (int i : values) sum += i; 
}
  • 숫자를 여러 개 직접 넘기거나, 배열로 넘겨서 호출 가능

2. 객체 상태 제어 (Car 클래스)

  • setGas(int gas): 가스 주입
  • checkGas(): 가스 확인
  • run(): 가스를 소모하며 반복 달리기
if (car.checkGas()) {
    car.run();
}
  • 가스가 소진될 때까지 while문으로 반복 달리다가 종료

✅ 오후 수업 요약

1. 메서드 오버로딩 (calculator 클래스)

  • 같은 이름 다른 매개변수로 여러 기능 제공
double areaRectangle(double width)
double areaRectangle(double width, double height)
  • 정사각형 넓이, 직사각형 넓이 각각 계산

2. this 키워드 (Car 클래스 - ch06.sec09)

  • 생성자 매개변수와 필드 이름이 같을 때 구분
  • 메서드 내부에서 다른 메서드 호출할 때도 사용
this.model = model;
this.setSpeed(100);

3. static 필드와 메서드 (Calculator, Television)

  • static 키워드 사용하여 클래스 수준에서 값 공유
Calculator.pi
Calculator.plus(10, 5)
Television.info
  • static 블록으로 초기화 코드를 클래스 로딩 시 자동 실행
static {
    info = company + "-" + model;
}

4. static 메서드 안에서 인스턴스 사용 (Car 클래스 - ch06.sec10.exam03)

  • static 메서드 안에서는 인스턴스를 직접 생성해서 인스턴스 필드를 사용
static void simulate() {
    Car car = new Car();
    car.speed = 200;
    car.run();
}

📌 11일차 핵심 요약표

개념 주요 내용
가변 인자 int... values로 매개변수 여러 개 받기
메서드 오버로딩 같은 이름, 다른 매개변수 메서드 작성
this 사용 필드와 매개변수 이름 구분, 메서드 내부 호출
static 필드/메서드 클래스명으로 직접 접근, 인스턴스 없이 사용
static 초기화 블록 클래스 로딩 시 1회 실행
static 메서드 안 인스턴스 사용 객체 생성 후 인스턴스 필드/메서드 접근

 

댓글
반응형

✅ 1. 클래스와 객체 생성 기본 (ch06.sec06.exam01 ~ exam02)

📌 필드 초기화 없이 기본값 확인

Car car = new Car();
System.out.println(car.model); // null
System.out.println(car.start); // false
System.out.println(car.speed); // 0

📌 필드에 값 대입 후 출력

car.company = "현대자동차";
car.model = "그랜저";
  • 필드는 객체 생성 후 직접 접근하여 값 설정 가능

✅ 2. 생성자 선언과 객체 생성 (ch06.sec07.exam01 ~ exam04)

📌 생성자 선언

Car(String model, String color, int maxSpeed) {
    this.model = model;
    this.color = color;
    this.maxSpeed = maxSpeed;
}

📌 오버로딩된 생성자

  • 생성자 여러 개 정의 가능 (매개변수 다르게)
Car()
Car(String model)
Car(String model, String color)
Car(String model, String color, int maxSpeed)

📌 생성자 호출 예

Car car = new Car("택시", "검정", 200);

✅ 3. 생성자에서 this 사용 (ch06.sec07.exam02 – Korean 클래스)

  • this.name, this.ssn은 필드와 매개변수 이름이 같을 때 구분하기 위해 사용
public Korean(String name, String ssn) {
    this.name = name;
    this.ssn = ssn;
}

✅ 4. 메서드 선언 및 호출 (ch06.sec08.exam01 – Calculator 클래스)

📌 메서드 종류

void powerOn()
int plus(int x, int y)
double divide(int x, int y)
void powerOff()

📌 호출 예

Calculator cal = new Calculator();

cal.powerOn();
int result = cal.plus(5, 6);
double result2 = cal.divide(10, 4);
cal.powerOff();

📌 10일차 핵심 요약

개념 설명
클래스 필드와 생성자, 메서드를 포함하는 사용자 정의 타입
객체 생성 new 키워드를 사용하여 클래스 인스턴스 생성
생성자 객체 초기화 시 사용되는 특별한 메서드
생성자 오버로딩 매개변수에 따라 다양한 생성자 제공 가능
this 키워드 필드와 매개변수 이름을 구분할 때 사용
메서드 정의/호출 기능을 수행하고 값을 반환하거나 출력

 

댓글
반응형

오전 수업 요약

1. 문자열 참조 비교 (== vs .equals())

strArray[0] = "Java";
strArray[2] = new String("Java");
  • == : 주소(참조) 비교
  • .equals() : 문자열 내용 비교
  • 결과:
    • strArray[0] == strArray[1] → true
    • strArray[0] == strArray[2] → false
    • strArray[0].equals(strArray[2]) → true

2. 향상된 for문 (for-each)

int[] x = {95, 71, 84, 93, 87};
for (int y : x) sum += y;
  • 배열 전체 반복을 간단하게
  • 평균 계산 실습

3. main 메서드의 인자 사용 (args[])

String str1 = args[0];
int num1 = Integer.parseInt(str1);
  • 실행 시 인자 2개 필요
  • 두 정수의 합 계산 및 출력
  • 입력값 없을 경우 종료 처리

오후 수업 요약 (실습 중심)

1. mission6 - 2차원 배열 구조 확인

static void mission6() {
		int[][] array = { { 95, 86 }, { 83, 92, 96 }, { 78, 83, 93, 87, 88 } };

		System.out.println("배열의 줄 : " + array.length);
		for (int i = 0; i < array.length; i++)
			System.out.println((i + 1) + "번째 배열의 칸 : " + array[i].length);

	}
int[][] array = { {95, 86}, {83, 92, 96}, {78, 83, 93, 87, 88} };

 

  • .length로 줄(행) 수와 칸(열) 수 확인
  • 출력 예:
배열의 줄 : 3
1번째 배열의 칸 : 2

 

2. mission7 - 최대값 구하기

static void mission7() {
		int array[] = { 1, 5, 3, 8, 2 }, max = 0;

		for (int num : array)
			if (num > max)
				max = num;

		System.out.println("max num : " + max);
	}
int[] array = {1, 5, 3, 8, 2};
  • 향상된 for문 사용
  • 조건문으로 최대값 판별

3. mission8 - 2차원 배열 총합 및 평균

static void mission8() {
		int array[][] = { { 95, 86 }, { 83, 92, 96 }, { 78, 83, 93, 87, 88 } }, sum = 0, count = 0;

		for (int i = 0; i < array.length; i++) {
			count += array[i].length;
			for (int j = 0; j < array[i].length; j++)
				sum += array[i][j];
		}

		System.out.println("점수의 전체 합 : " + sum);
		System.out.println("점수 전체의 평균 : " + (double) sum / count);
	}
  • 합산 및 요소 수 카운트 → 평균 출력
sum += array[i][j];
count += array[i].length;

4. mission9 - 학생 점수 관리 프로그램

static void mission9() {
		Scanner sc = new Scanner(System.in);
		String str;
		int count = 0, scores[] = null, sum = 0;

		while (true) {
			System.out.println("-".repeat(40));
			System.out.println("1. 학생수 | 2. 점수입력 | 3. 점수리스트 | 4. 분석 | 5. 종료");
			System.out.println("-".repeat(40));
			System.out.print("선택> ");
			str = sc.nextLine();

			if (str.equals("1")) {
				System.out.print("학생수> ");
				str = sc.nextLine();
				count = Integer.parseInt(str);
				scores = new int[count];
			} else if (str.equals("2")) {
				if (scores == null) {
					System.out.println("현재 정해진 학생 수가 없습니다.");
					continue;
				}

				for (int i = 0; i < scores.length; i++) {
					System.out.print("scores[" + i + "]>");
					str = sc.nextLine();
					count = Integer.parseInt(str);
					scores[i] = count;
				}
			} else if (str.equals("3")) {
				for (int i = 0; i < scores.length; i++)
					System.out.println("scores[" + i + "] : " + scores[i]);
			} else if (str.equals("4")) {
				for (int i : scores) {
					if (i > count)
						count = i;
					sum += i;
				}

				System.out.println("최고 점수 : " + count);
				System.out.println("평균 점수 : " + (double) sum / scores.length);
			} else if (str.equals("5"))
				break;
		}

		System.out.println("프로그램 종료");
	}
  • 메뉴 기능 구성:
    1. 학생 수 설정
    2. 점수 입력
    3. 점수 출력
    4. 최고 점수 및 평균 분석
    5. 종료
  • 입력/출력 및 예외 처리 포함

🧠 9일차 핵심 요약표

주제 내용
문자열 비교 == (참조), .equals() (내용)
향상된 for문 배열 반복 간단화
main 인자 외부 입력값 처리 및 타입 변환
2차원 배열 구조 확인, 평균 계산
실습 문제 최대값, 총합, 점수 분석 프로그램 구현

 

댓글
반응형

🕘 오전 수업 요약

✅ 배열 생성과 기본값 확인

  • new 키워드를 사용해 int[], double[], String[] 배열 생성
  • 기본값:
    • int → 0
    • double → 0.0
    • String → null

✅ 배열 값 할당 및 출력

  • 인덱스를 이용해 값 저장 및 출력
arr1[0] = 10; arr2[1] = 0.2; array[2] = "3월";

✅ 배열의 길이 활용 (.length)

  • 반복문에 배열 길이 활용 (for (int i = 0; i < arr.length; i++))
  • 총합과 평균 계산 실습

🕐 오후 수업 요약

✅ 1. 2차원 배열 생성과 값 출력 (MulltidimensionalArrayByValueListExample)

  • 중첩 배열 사용: int[][] scores = { {80,90}, {76,88}, ... }
  • 반별 점수 출력과 평균 계산
  • 전체 학생 수 집계와 전체 평균 계산
System.out.println("scores[" + i + "][" + j + "] : " + scores[i][j]);

✅ 2. 고정형 2차원 배열 (MultidimensionalArrayByNewExample)

  • new int[2][3] → 2행 3열 배열 생성
  • 모든 요소 출력 후 값 입력, 평균 계산

✅ 3. 가변형 2차원 배열

  • 행마다 열 개수가 다른 배열 구조
int[][] eng = new int[2][];
eng[0] = new int[2];
eng[1] = new int[3];
  • 각각의 행에 점수 대입 후 전체 평균 계산

📌 8일차 핵심 요약

항목 설명
배열 기본 생성 new 타입[길이]로 생성, 기본값 자동 지정
2차원 배열 생성 new 타입[행][열] 또는 { {..}, {..} }
가변 배열 행마다 열 개수가 다름 (new 타입[행][])
평균 계산 반복문 + .length 조합으로 총합 및 평균 계산
중첩 반복문 2차원 배열 순회 시 for문 2중 사용

 

댓글
반응형

✅ 오전 수업 요약: 문자열 메서드 심화

1. length() – 문자열 길이 확인

  • 주민등록번호 등 입력 자릿수 검증에 사용
if (str.length() == 13) { ... }

2. replace() – 문자열 치환

  • 특정 문자열을 다른 문자열로 변경
  • 원본 문자열은 변경되지 않음 (불변)
String replaced = str.replace("자바", "Java");

3. substring() – 문자열 자르기

  • 주민등록번호를 앞자리/뒷자리로 나누는 예제
str.substring(0, 6);   // 앞 6자리
str.substring(7);      // 8번째 문자부터 끝까지

4. indexOf(), contains() – 문자열 포함 여부

  • indexOf()는 위치 반환, 없으면 -1
  • contains()는 true/false 반환
if (str.contains("자바")) { ... }

✅ 오후 수업 요약: 배열 활용 및 문자열 분리

1. split() – 문자열 분리

  • 구분자 기준으로 문자열을 배열로 분리
String[] data = str.split(",");
  • 배열 요소를 반복문으로 출력

2. 배열 선언과 초기화

String[] season = {"봄", "여름", "가을", "겨울"};
season[1] = "Summer"; // 값 변경 가능

3. 배열을 이용한 총합 및 평균 계산

int[] scores = {83, 90, 87};
int sum = 0;
for (int i = 0; i < scores.length; i++)
    sum += scores[i];
double avg = (double) sum / scores.length;

4. new 키워드를 통한 배열 재할당

scores = new int[] {83, 90, 87};
  • 배열을 새롭게 생성하여 교체 가능

📌 7일차 핵심 요약표

항목 주요 내용
문자열 길이 확인 length()
문자열 치환 replace()
문자열 자르기 substring()
문자열 검색 indexOf(), contains()
문자열 → 배열 split(",")
배열 선언/사용 {...} 목록 초기화, 인덱스 접근
평균 계산 누적 합 → double 캐스팅 후 평균
배열 재생성 new 키워드로 새 배열 대입 가능
댓글