전체 글
-
20240820 6일차카테고리 없음 2024. 8. 20. 17:29
[기본형/참조형 변수] - 기본형: 값을 복사해서 대입 가능 - 참조형: 하나의 객체를 참조값을 통해 여러 변수에서 공유 가능 [가변 객체 (mutable object)와 side effect] - copy by reference: A의 인스턴스 주소값을 B의 인스턴스에 복사 후, A의 인스턴스 변수값만 변경해도 B의 인스턴스 변수값이 같이 변경됨 - 이 문제를 어떻게 해결할까? -> 불변 객체 [불변 객체 (immutable object)] - 클래스 작성 시 인스턴스 변수 선언에 final 예약어 붙이기 - setter 작성 X - 불변 객체 예시: String 클래스 * 클래스 자체가 final로 선언되어있기 때문에, 다른 클래스에서 String 클래스를 상속받지 못함 * setter 메소드가..
-
[오류 해결] docker-compose.yml로 데이터베이스 및 테이블 생성카테고리 없음 2024. 8. 19. 22:52
문제: docker-compose.yml 파일 작성 → docker-compose up -d --force-recreate 명령어 실행 → docker container 실행 확인 (O) → database 및 table 생성 확인 (X) docker-compose.ymlversion: '3.8'services: mysql: container_name: mysql_local image: mysql:8.0.30 volumes: - ./db/conf.d:/etc/mysql/conf.d - ./db/initdb.d:/docker-entrypoint-initdb.d ports: - "3307:3306" environment: - MYSQL_DATA..
-
20240816 4일차카테고리 없음 2024. 8. 16. 17:35
[static] - static 키워드를 통해 static 영역에 할당된 메모리는 모든 객체가 공유하는 메모리임 - static 변수는 class 변수임 - 객체를 생성하지 않고도 static 자원에 접근 가능 (객체가 생성되기 전에 이미 할당됨) [생성자] - 원래는 class에 하나 이상의 생성자를 선언해야하지만, 선언하지 않아도 new 키워드를 통해 객체 생성이 가능함 - 컴파일러가 생성자가 하나도 없을 때 기본 생성자를 추가해줌 [클래스 선언과 객체 생성] - class에 선언된 field는 해당 field 데이터타입의 기본값으로 초기화 됨 - 2개 이상의 클래스를 하나의 파일로 선언하는 경우, 하나의 클래스만 public으로 선언할 수 있고, 해당 클래스 이름은 소스파일 이름과 동일해야 함 클래..
-
JVM이란 (내용 더 추가하깅)카테고리 없음 2024. 8. 14. 17:46
JVM - Java Virtual Machine - Java bytecode가 플랫폼에 독립적으로 실행될 수 있게 지원하는 가상머신 - JVM은 플랫폼에 종속적, Java는 JVM 덕분에 플랫폼에 독립적 - JVM의 메모리 공간(Runtime Data Area)는 크게 3가지 영역 - Method(Static) 영역, Stack 영역, Heap 영역으로 구분됨 stack - main() method안의 내용을 실행 후 return (LIFO) - 변수, 참조값, ... 가 저장됨 heap - 객체를 저장하는 공간 - 자동으로 메모리 관리가 되지 않기 때문에 GC가 일어남 - 왜 Java는 register 대신에 stack을 쓸까? - Java의 원래 목적은 하드웨어에 종속되지 않고 어디에서든지 실행될 ..
-
20240814 3일차카테고리 없음 2024. 8. 14. 17:40
IntelliJ 단축키 Ctrl + Alt + M: 해당 블록을 함수로 만들어줌 switch-case문: case에 변수, 실수는 올 수 없다 ❌궁금증이 생겼다! - String str = "Hello World"; - String str = new String("Hello World"); 두가지 경우 모두 다 heap에 객체가 할당되는걸까? [method overloading] method signature (3가지): - method 이름 - method 매개변수 개수 - method 매개변수 타입의 순서 * method return 타입은 메소드 시그니처에 포함되지 않는다!❌method overloading : 같은 이름의 메소드를 중복해서 정의하는 것 메소드 이름은 같지만, 메소드 시그니처가 다른..
-
20240813 2일차카테고리 없음 2024. 8. 13. 17:46
gitlab.com: Jenkins할 때 많이 씀[SVN vs Git] SVN - 중앙 집중식 형상관리 소스 관리툴 - 온라인 상태에서만 작업 가능 - 동일한 저장소를 공유하며 동시에 작업하는 경우에 충돌 방지를 위한 잠금 기능이 있음 Git - 분산 버전 형상관리 시스템 - 로컬 리파지토리를 사용해서 작업 가능 - git branch merge 시, 충돌이 발생할 수 있음 [Git 설치] - 요즘은 default branch로 'master' 대신 'main'을 활용함 [Git 버전 되돌리기] revert - 버전을 되돌려서 새로운 버전 만들기 - N번째 버전까지 있을 때, N-1 버전과 동일하게 N+1의 새로운 버전을 만듦 reset - 버전을 완전히 되돌리기 - N번째 버전까지 있을 때, N-1 버..
-
20240812 1일차카테고리 없음 2024. 8. 12. 17:47
Java는 컴파일 언어이면서 인터프리터 언어이기도 하다(JVM) 자바는 한번 컴파일 하면 플랫폼에 독립적으로 실행 가능 (JVM) JVM은 플랫폼 종속적/자바는 JVM 덕분에 플랫폼 독립적 Spring 3.x는 Java 17과 호환됨 Java 설치 경로: C:\Program Files\Java\jdk-17.0.12 IntelliJ 프로젝트 경로: C:\JavaWorkIntelliJ 설정 Project를 생성할때마다 설정할 것 1. Settings - Build, Execution, Deployment - Compiler - Build project automatically 체크 2. Settings - Advanced Settings - Compiler - Allow auto-make~ 체크 한글 깨짐 ..
-
[Spring] JsonProperty카테고리 없음 2024. 8. 9. 15:11
Jackson 라이브러리의 JsonProperty 어노테이션을 이용하여 JSON 데이터와 Java 클래스의 필드를 맵핑 시켜줄 수 있다. 사용법import com.fasterxml.jackson.annotation.JsonProperty; 예시import com.fasterxml.jackson.annotation.JsonProperty;public class DocumentDto { @JsonProperty("place_name") private String placeName; @JsonProperty("address_name") private String addressName; @JsonProperty("y") private double latitude; @Jso..