Computer Science Canada No pointers...hmm... |
Author: | Martin [ Thu Nov 04, 2004 3:59 pm ] |
Post subject: | No pointers...hmm... |
Okay, I have a set of 5 objects, each of which is storing a number. I need to return the object associated with the lowest number. With C++, I could use a pointer, but how would I do this with Java? |
Author: | Dan [ Thu Nov 04, 2004 4:05 pm ] |
Post subject: | |
have u tryed just retruning the object? lol ie. return objectName or am i missing the point of your post? |
Author: | rizzix [ Thu Nov 04, 2004 4:08 pm ] | ||
Post subject: | |||
assuming you define a method for each object to retrive the value of the stored number as getNumber then all you need to do is probably something like this (assuming that the 5 objects are in an array called objects and StoringObject is the name of the class that defines these objects)
|
Author: | Martin [ Thu Nov 04, 2004 4:09 pm ] |
Post subject: | |
Yeah, nevermind, it was a dumb question. I'm just slow lately. |