View Single Post
  #1 (permalink)  
Old 07-24-2007, 04:59 PM
zoe zoe is offline
Member
 
Join Date: Jul 2007
Posts: 40
zoe is on a distinguished road
Help with array of elements
I'm fairly new to Java. I'm currently making a text RPG which I'm trying to port from C++. In the Java code, I have a class called Item that contains all my item variables and methods. Then, I have another class that is the Game class which is the game itself. Here is where all the items, players, etc.. get initialized. Right now I have something like:

Item club = new Item("club", 1, "A club");

Now, in C++ I used a estructure to get an array of item. This made it easy, for example, to tell where items are, since I could just do a for loop and cycle through the entire item list by using item[i].location.

Is there any way to make an array of type Item (or any class in general) in Java?
Thanks.
Reply With Quote
Sponsored Links