* 전역 변수, 인스턴스 변수, 로컬 변수
public class VariableExample {
// 전역 변수 (Global Variable)
static int globalVar = 10;
// 인스턴스 변수 (Instance Variable)
int instanceVar = 20;
public static void main(String[] args) {
// 로컬 변수 (Local Variable)
int localVar = 30;
System.out.println("전역 변수: " + globalVar);
VariableExample obj = new VariableExample();
System.out.println("인스턴스 변수: " + obj.instanceVar);
System.out.println("로컬 변수: " + localVar);
}
}
* 메서드 호출과 JVM Stack 메모리
메소드가 호출될 때마다 새로운 프래임이 생성된다.
* Call by reference
JVM Stack 은 로컬 변수를 저장한다.
Heap 은 New로 생성된 변수가 저장된다. (인스턴스 변수)
Method Area은 JVM의 메모리 영역 중 하나로,
JVM이 클래스와 인터페이스의 메타데이터를 저장하는 공간
* 객체와 Call by reference
* 객체 생성과 리턴
https://dev-with-gpt.tistory.com/101
자바 ex06 흐름 제어문 : Exam0140 ~ Exam0450
Exam0140 - 흐름 제어문 : if ~ else 문 package com.eomcs.lang.ex06; //# 흐름 제어문 - if ~ else 문 // public class Exam0140 { public static void main(String[] args) { int age = 17; // if 문은 else 문 없이 단독으로 사용할 수 있다.
dev-with-gpt.tistory.com
https://dev-with-gpt.tistory.com/102
자바 ex07 메서드 : Exam0240 ~ Exam0540
Exam0240 - 메서드 : 개념 및 기본 문법 IV package bitcamp.ex07; //# 메서드 : 개념 및 기본 문법 IV // public class Exam0240 { // 4) 메서드 : 리턴값(O), 파라미터(O) // => "이 돈 갖고 과자좀 사와!" static String hello(Str
dev-with-gpt.tistory.com
https://dev-with-gpt.tistory.com/103
자바 프로그래밍. 배열 : 나의 목록 관리 시스템 구현 (static 전역 변수 활용)
https://dev-with-gpt.tistory.com/88 자바 프로그래밍. 배열 : 나의 목록 관리 시스템 구현 (여러가지 값 입력받기) 오늘 수업은 Scanner를 통해 사용자에게 Data를 입력받고 해당 정보를 저장하여 출력해주는
dev-with-gpt.tistory.com