Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in passing a two dimensional array from one class to another

 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class probabilityMatrix
{
double[][] getMatrix()
{
double[][] arr = new double[][];
// array manipulation
return arr;
}
}

class page
{
void meth1()
{
probabilityMatrix a1 = new probabilityMatrix();
double d[][]=a1.getMatrix();
//print d[][];
}
}

This is what i have done in one of my programs. but it is showing the following error. i need help.


C:\Documents and Settings\Aruljose\Desktop>java page
Exception in thread "main" java.lang.NullPointerException
at probabilityMatrix.getMatrix(page.java:62)
at page.main(page.java:269)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jose jose", please see the warning about your display name here.
 
shandilya popuru
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ur class does not have a main method
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jose",
Thank you for taking the time to change your display name, but unfortunately it is still not valid.

We require your display name to be two words: your first name, a space, then your last name.

Please try again.

Thanks,
Dave.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic