

int global_var = 10; // 초기화된 전역 변수
static int static_var = 20; // 초기화된 정적 변수int global_var_uninitialized; // 초기화되지 않은 전역 변수
static int static_var_uninitialized; // 초기화되지 않은 정적 변수PriorityQueue<Integer> pq = new PriorityQueue<>(); // 힙 자료구조를 사용
String s = new String("hello"); // 힙 메모리를 사용
int[] numbers = new int[10]; // 배열도 힙 메모리에 저장
List<Integer> list = new ArrayList<>(); // 리스트 객체가 힙에 저장class Car {
String model;
}
Car myCar = new Car(); // myCar 객체가 힙 메모리에 생성for (int i = 0; i < 3; i++) {
A(); // A 함수가 반복적으로 호출됨
} void A() { B(); }
void B() { C(); }
void C() { /* 작업 */ }