public class Bucket
{
int rows,cols,blocked,open,full;
public void initialize()
{
rows=0;
cols=0;
blocked=0;
System.out.println("You were here");
}
public void open()
{
blocked=1;
}
}
I am getting a null pointer exception when I am running the percolation class, I don't have any clue, how to get rid of it, any help will be very thankful.
public class Percolation
{
//public Percolation(int N)
public static void main(String args[])throws Exception
{
try
{
int N=5;
Bucket[][] barray=new Bucket[N][N];
for(int i=0;i<N;i++)
{
for(int j=0;j<N;j++)
{
barray[i][j].initialize();
//barray[i][j].cols=0;
//barray[i][j].blocked=0;
}
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}