Example
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Example 9-1: Additional array declaration and creation examples

// A list of 4 floating point numbers
float[] scores = new float[4]; 

// A list of 100 Human objects
Human[] people = new Human[100]; 

 // Using a variable to specify size
int num = 50;
Car[] cars = new Car[num];

// Using an expression to specify size
Spaceship[] ships = new Spaceship[num*2 + 3]; 


»

No comments yet.

Leave a comment