If i have an array of integers called, say, integerArray, and i am looking for the last location that contains, say, 1, then how do i use the lastIndexOf() method, as it does not seem to work when i try it.
my code is similar to:
Thanks [ November 13, 2005: Message edited by: Sam Bluesman ]
Arrays don't have methods and have only 1 field, length. java.util.Arrays has some utility methods for arrays, but no lastIndexOf, so you'll have to write your own utility class that implements it. Just traverse the array backwards, starting at intArray.length - 1.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Rob Spoor: Arrays don't have methods
Actually they have all the methods of the class java.lang.Object: equals(), hashCode(), wait(), notify(), notifyAll(), toString(), finalize(), getClass(), and clone() (which is public in all array classes.)