Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • 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
Pie
Posts: 20529
54
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
Sheriff
Pie
Posts: 48964
60
  • 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