[Help] Help with arrays

Posts 1–7 of 7 · Page 1 of 1
[Help] Help with arrays
Okay. I don't usually ask for too much help, but whenever it comes to arrays, I always have too look back at some sort of reference. What would be the best practice to get arrays down for sure? Any help would be appreciated, thanks.
What aspect of arrays? Just the syntax for creating them? Or the related member functions they have in java (wait, I am thinking of java, right?)

If you are just trying to get the syntax down then really the only way to do it is through repetition. Do it often enough then it will become ingrained into your mind.

Just try to write an unnecessarily long program that has lots of arrays. Or maybe until you are used to them, instead of creating normal variables, always create arrays with 1 element (because even though it is pointless it will surely give you a lot of practice)
Like.. I know there's a way to get a file name, and it requires using arrays.. and a loop, but yeah. Basically the utilization of arrays is what I need help with. Cause I know how to use them, but I find them some what useless. So just need a way to use them for practice.
Array's are very important and very easy in Java. As for getting a file name. Im sure there's some class for listing files in a directory. I don't use Java much anymore so I can't remember off the top of my head, but when in doubt check the Java API.

EDIT: Followed my own advice...
Quote Originally Posted by Java API
listFiles

public File[] listFiles(FileFilter filter)

Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the listFiles() method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true results when the FileFilter.accept(java.io.File) method of the filter is invoked on the pathname.

Parameters:
filter - A file filter
Returns:
An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
Throws:
SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the directory
That sorta helps. Thanks guys. And gratz on the game hacking team thingy! :O!
I hope it's a perma ban. But I think I got them down. And the way you read a line of text, and you don't put anything in the array brackets... Which is weird. You use the FileReader import and BufferedReader. Anyways, you pass down the File reader into the buffered reader. Like this:

Code:
FileReader fr = new FileReader();
BufferedReader read_line = new BufferdReader(fr);
Something might go in the FileReader. Maybe "this". I forgot. I prolly gotta check the source. But yeah. Thanks for that API ref.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us