File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes printing the values of an array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "printing the values of an array" Watch "printing the values of an array" New topic

printing the values of an array

Savanna Ray

Joined: Nov 20, 2004
Posts: 9

I have almost finished making this code work. It's supposed to print out the name/value pairs of a query string (eg.from a form URL query string).
I've got it to print out the 'name' part of the pair array, but can't seem to print out the 'value' part.

Here's the code:

I changed the print method, in util class, to take a String name as well, but it didn't compile. Any suggestions on how to print the last half of the array?

Thanks so much...
Almost finished
Savanna Ray

Joined: Nov 20, 2004
Posts: 9
I thought it would be able to access the form class from the print method, but compiling says it can't find symbol variable form.
Maybe I should be invoking the method getValue differently?
Rick Portugal
Ranch Hand

Joined: Dec 17, 2002
Posts: 243
I'm not completely sure what you're trying to accomlish. It seems that this code could be simplified. But take a look at this and let me know if this helps:

I made the getValues() method just like the getNames() method. I also changed the Util.print() method to accept two arrays of Strings. I'm puzzled as to why the Util.print method uses arrays called array and name. I would have expected something like "name" and "value".

Hope that helps.

I agree. Here's the link:
subject: printing the values of an array
It's not a secret anymore!