Kosta 클라우드 네이티브 애플리케이션 개발 (CNA) 교육 13일차
2024. 12. 4. 17:42ㆍKosta 클라우드 네이티브 어플리케이션 개발(CNA) 교육
JAVA
JDK (Java Development Kit)
- 구성 요소: 개발 도구(컴파일러, 디버거 등)와 JRE 포함.
- 역할: 자바 프로그램을 개발하고 실행하는 환경을 제공
JRE (Java Runtime Environment)
- 구성 요소: JVM과 시스템 라이브러리.
- 역할: 자바 프로그램을 실행할 수 있는 환경을 제공
JVM (Java Virtual Machine)
- 구성 요소: 클래스 로더, 실행 엔진, 런타임 데이터 영역 등.
- 역할: 바이트코드를 해석하고 실행하여 자바 프로그램을 실제로 동작
구동 순서
- 소스 코드 작성: .java 파일 작성.
- 컴파일: javac로 바이트코드(.class 파일) 생성.
- 클래스 로딩: JVM의 클래스 로더가 바이트코드를 메모리에 로드.
- 실행 엔진: 바이트코드를 해석하여 실행.
- 가비지 컬렉션: 사용되지 않는 객체를 메모리에서 제거.
클래스 : 함수와 변수를 가지고 있는 집합
public class chap06_Method {
public static void main(String[] args) {
chap06_Method method = new chap06_Method();
// System.out.println( Arrays.toString( method.select(77) ) );
// System.out.println( Arrays.toString( method.select() ) );
method.printSet( method.select(77) );
method.printSet( method.select() );
method.insert(7, "SMITH");
method.update(100, 10);
method.delete(200);
System.out.println("---------------");
}
public void printSet(String[] str) {
System.out.print("[ ");
for(int i = 0; i < str.length; i++) {
System.out.print( (i != str.length -1) ?
str[i] + ", " :
str[i] + " ]\n"
);
// System.out.print(str[i]);
// if( i != str.length -1)
// System.out.print(", ");
// else {
// System.out.println(" ]");
// }
}
}
public String[] select(int 부서번호) {
return new String[]{ "파라미터 있음" , 부서번호+"" };
}
public String[] select() {
return new String[]{ "파라미터", "없음" };
}
public int insert(int 사원번호, String 사원명 ) {
int rows = 사원번호 * 3;
System.out.println("rows = "+rows + "\trows = 사원번호*3");
return rows;
}
public void update(int 사원번호, int 급여 ) {
System.out.println("사원번호 = "+사원번호+"\t급여 = "+급여 + "\t 업데이트 완료");
}
public void delete(int 사원번호 ) {
System.out.println("사원번호 = "+사원번호+"\t삭제 완료");
}
}
import com.lec.TestVo;
/*
***************************************************************
*
* 생성자 (Constructor)
* 모든 클래스는 반드시 하나 이상의 생성자가 있다.
* 역할 : 인스턴스 초기화
* 언제 : new
* 만들기 : public 클래스이름()
* 종류 : new 생성자()
* new 생성자(파라미터...)
*
*
***************************************************************
*/
public class chap06_construct {
// static 블럭, 가장 먼저 실행된다.
static{
}
// 초기화 블럭은 생성자 함수보다 먼저 실행된다.
// 모든 생성자마다 공통으로 할 일이 있다면 초기화 블럭에 넣으면 된다.
{
//...
} // 초기화블럭
int a;
int b;
int c;
// 생성자와 변수 호출의 라이프사이클은( 생존주기 ) 다르다
public void chap06_construct() {
int point = 3333;
}; // 메서드, 리턴값이 있다
public chap06_construct() {}; // 생성자, 리턴값이 없다
public chap06_construct(int a) {
this(); // 생성자 호출, new chap06_construct(); 와 같다
}
// 초기화 담당
public chap06_construct(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
/*
**********************************************
* this() : 함수
* this : 참조변수 -> 인스턴스화 된 주소값( new 하고 난 후 그 주고값 )
*
**********************************************
*/
public static void main(String[] args) {
//-----------------
//this(); // static 안에서는 this(), this 사용불가
//-----------------
chap06_construct con = new chap06_construct(1,2,3);
System.out.println(""+con.a+con.b+con.c );
// TestVo t = new TestVo();
// t.setPoint(10);
// System.out.println(t);
}
}
'Kosta 클라우드 네이티브 어플리케이션 개발(CNA) 교육' 카테고리의 다른 글
Kosta 클라우드 네이티브 애플리케이션 개발 (CNA) 교육 15일차 (1) | 2024.12.06 |
---|---|
Kosta 클라우드 네이티브 애플리케이션 개발 (CNA) 교육 14일차 (1) | 2024.12.05 |
Kosta 클라우드 네이티브 애플리케이션 개발 (CNA) 교육 12일차 (1) | 2024.12.03 |
Kosta 클라우드 네이티브 애플리케이션 개발 (CNA) 교육 11일차 (1) | 2024.12.02 |
Kosta 클라우드 네이티브 애플리케이션 개발 (CNA) 교육 10일차 (2) | 2024.11.29 |