Home | Unit 1 | Unit 2 | Unit 3 | Unit 4 | Unit 5 | Unit 6 | Unit 7 | Unit 8 | Unit 9 | Reflection |
Unit 1
My notes on unit 1.
- Basics of Java
- Stack Memory (LIFO)
- Heap Memory
Basics of Java
Reference vs. Primitive Types
Reference Types: Objects/classes, spelled in CamelCase, things like Strings or arrays
- Stores address of data on stack, data is on heap
- Pass by reference
Primitive Types: A value that is an byte
, short
, int
, long
, double
, boolean
, float
, or char
- On the stack therefore point directly to content
- Pass by value
Stack vs. Heap
Stack: Type of data structure, LIFO, manages temporary variables in functions and stuff
- Has variables of primitive types and also references to objects
- Primitive types stored directly, reference types store address
Heap: Type of data structure, dynamic memory allocation
- Stores data from reference types
Stack Memory (LIFO)
Stores method calls and local variables
Heap Memory
Stores objects and arrays