View Single Post
Old Nov 10th, 2006, 7:31 AM   #1
flamblob
Newbie
 
Join Date: Nov 2006
Posts: 1
Rep Power: 0 flamblob is on a distinguished road
Exclamation Help with object arrays

hey all, im trying to learn java and im having some trouble grasping arrays pointing to objects. All of my programs fail to compile with the same "cannot resolve symbol" error. I made a simplified script to show you what I am talking about. It gives me the symbol error and points to uno[count].theThing(). This would be the same in all my other programs regardless of the object name. I can't figure this out!!

class test {
public static void main(String[] args) {
int x=3; // the number of spots in the array
int x1; // a copy
theThing[] uno; // declare the array
uno = new theThing[x]; //give 3 spots to array
x1 = x; //copy x
while (x1>0) {
uno[x1] = new theThing();	//make the objects
x1--;

}// end while

tester(x); //go to the method
System.exit(0);

}// end main

static void tester(int count) {
while (count>0) {
System.out.println(uno[count].theThing()); //calls to theThing for theNumber
count--;
}// end while

}// end tester


}// end class test


class theThing {
int theNumber = 77;
int theThing() {
return theNumber;
}// end theNumber

}//end theThing
flamblob is offline   Reply With Quote