View Single Post
Old May 22nd, 2006, 8:55 PM   #5
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 903
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
@tumbleTetris: To answer your question, you could keep track of how many letters have been added to each array and only print the value of the indices up to that number. Or you could use NScharr's idea and only print the values of the array that are not null (or whatever the default value of a char[] array is).

I believe a better way to keep track of the letters that have been entered would be to use an ArrayList. (If you are worried about speed, which I doubt, you can use the initialCapacity constructor.) This way, you can simply add letters to either list and print the list, which will contain only those letters.

Last edited by titaniumdecoy; May 22nd, 2006 at 9:16 PM.
titaniumdecoy is offline   Reply With Quote