This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Pass 2D array between methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pass 2D array between methods" Watch "Pass 2D array between methods" New topic

Pass 2D array between methods

Ralph King

Joined: Sep 05, 2011
Posts: 1

I am struggling to pass my 2D array between classes. The following getMethod should return a valid 2D array:

public String[][] getResults(){
return (resultSet);

However when i try to access from another class my first attempts fall woefully short:

String test[][]=newData.getResults();

When I try to access elements they are all null. how do i accomplish this?

All help very welcome.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

Welcome to the Ranch!

Where and how have you initialized resultSet?

How To Ask Questions How To Answer Questions
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37865
Welcome again

I am afraid I am going pedantic: there is no such thing in Java™ as a 2D array. There are arrays of arrays, however.
I agree. Here's the link:
subject: Pass 2D array between methods
Similar Threads
Searching an Array
About access to relevant variables from variable name
remove duplicates from an array
getting 2D array view in jsp from actionform properties
web application design