3. Watch the story, built from zero
Story modeStory mode
20 scenes · about 4 min · narrated- just created
- slot being read or changed
- already looked at
In real life
A row of lockers with one student's marks in each. The doors are numbered from 0.
In the computer's memory
Variables
On the screen
Nothing printed yet
1public class Main {2public static void main(String[] args) {3int[] marks = {62, 85, 47, 91}; // a list of marks4System.out.println(marks[2]); // read one slot5marks[3] = 96; // change one slot6int best = marks[0]; // highest so far7for (int i = 1; i < marks.length; i++) { // i = 1 to 38if (marks[i] > best) {9best = marks[i];10}11}12System.out.println(best);13}14}