How-To: Initialise arrays of objects in Java

You might think, like I did, that if you create an array of objects in Java then the constructor is automatically called on each object as part of the array creation process. But you’d be wrong.

Creating an array merely creates the object references – you have to instantiate each “inner” object in the array as a separate step if you want to be able to, ya know, do stuff… I think this is because in Java an array is an object – like, quite literally a single object that can be passed around like a single thing.

An example, perhaps?

Person Class

PersonTestDrive Class

An introduction to ActionScript 3.0 – week 4 lesson 2

Learning actionscript? Want to know the gist of object creation and extending classes to do neat things? Then you’ve come to the right place…

Flash Week 4 Lesson 2

Download slides link: An Introduction to ActionScript 3.0 – Week 4, Lesson 2
Audience: Beginners who know a little about variables and how to perform some basic programming math.
Format: Powerpoint 2003 (so they can be opened in LibreOffice/OpenOffice, MS Office 2K3/2K7/2K10 etc.)
Template: OOo2 by Chih-Hao Tsai
Content License: These slides are released under a creative commons non-commercial attribution share-alike 3.0 license by me (r3dux) and come with no guarantee of correctness, fitness for purpose or anything of the sort.