Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Array of objects in Java
Name: SergeantFuzz Date: February 24, 2005 at 04:46:34 Pacific OS: Win XP Pro SP1 CPU/Ram: 256mb DDR
Comment:
I'm a beginner to Java. I need to create an array of objects. I have a class called child and a method to assign the age of a child. Then in my main method i want to create an array of child objects and assign a random age to each object in the array. How do you create an array that contains child objects? I've tried things like:
children [i] = new child();
but i can't get it to work! Any help would be appreciated.
Summary: How should I create an array of objects?? and use a variable afterwards in the programme?? (i'm a java programmer) Thanking You Monish Gogri. ...