How a program is organised in memory and what an object is.
Key points, notes and past questions
Core Java and the Runtime Memory Model
References, the call stack and what == compares.
- Loops, step by step
whileandfortest first.do-whileruns once before its first test.- A counter declared outside an inner loop is not reset.
- Arrays and references
- A parameter is a copy of the caller's value.
- For arrays that value is a reference.
- Writes through a reference are shared; reassignment is local.
clone()of a 2-D array shares the rows.
- Activation records
- One record per unfinished call.
- It holds parameters, locals and the links back.
- Last called, first finished.
- Recursion only means many records for the same method.
- Same object or same value
==on references asks "one object?".- Equal literals are one object;
newand run-time joining make others. - Boxes from -128 to 127 are shared.
Integer == intcompares numbers.
Notes3 past questions in this topic
Week 2: Data types, control flow, classes and objectsAll Java topics and weeks