Arrays - JAVA programming

Started by BigAl75, May 09, 2004, 11:51:21 PM

Previous topic - Next topic
May 09, 2004, 11:51:21 PM Last Edit: May 09, 2004, 11:55:35 PM by BigAl75
Anyone know how to put an object into an array?  I've been fighting with this program for 2 weeks now, and can't figure it out.

What I have to do is simulate a telephone company that monitors 100 phones.  Who calls who, how long they talk, if one phone's busy, etc.  Having problems getting the phone objects into the array.  Any help would be very appreciated.

Here's an example of an array of objects in java:

public class ArrayOfStringsDemo {
    public static void main(String[] args) {
        String[] anArray = { "String One", 
                             "String Two", 
                             "String Three" };

        for (int i = 0; i < anArray.length; i++) {
            System.out.println(anArray[i].toLowerCase());
        }
    }
}


This example was pulled directly from Sun's website. The URL is: http://java.sun.com/docs/books/tutorial/java/data/arraysOfObjects.html

I hope this helps you,

Wilnix
alt email address: wilnix@hackphreak.org

SMF spam blocked by CleanTalk