• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pass 2D array between methods

 
Ralph King
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all,

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
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Where and how have you initialized resultSet?
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!