Teacher
From Huben's Wiki
Line 114: | Line 114: | ||
9/27 | 9/27 | ||
Review: for test. | Review: for test. | ||
+ | 10/3 | ||
+ | Introducing students to roles of objects and variables is difficult. Need to distinguish: | ||
+ | * Variables come in two types. Basic types and object types. | ||
+ | * Basic types actually hold the data: integers, characters, doubles, booleans. | ||
+ | * Object types do not hold objects in them. Objects themselves are stored elsewhere, and the variable simply has their address. | ||
+ | * The actual objects know their classes. | ||
+ | * When you do 'String s = new String("abc");', these things happen: | ||
+ | * a piece of memory is picked (for s) | ||
+ | * new picks a part of memory the right size for your String object | ||
+ | * String() is the constructor, and puts your values into the object | ||
+ | * new returns the address of that part of memory | ||
+ | * the address is stored into s. | ||
-------------- | -------------- | ||
Later we will comeback to 2.3, 2.4 and the rest. After the basics of methods, variables and arguments. | Later we will comeback to 2.3, 2.4 and the rest. After the basics of methods, variables and arguments. | ||
Investigate changing from demons to spirits or goblins (what ever Harry Potter has). | Investigate changing from demons to spirits or goblins (what ever Harry Potter has). |