I am getting a NullPointerException error and I cannot see where it is. It points to line 19 but I can't find what's wrong.
Code:
import java.awt.*;
import java.lang.Object;
public class Algorithm {
public static void main (String args[]) {
int deletedLines = 0;
Label place[][];
place = new Label[9][9];
int counter=1;
for (int i=0; i<9; i++)
{
for (int j=0; j<9; j++)
{
place[i][j].setText("aa");
}
}
// HORIZONTAL LINES SEARCH
for (int i=0; i<9; i++)
{
for (int j=0; j<5; j++)
{
if (place[i][j].getText() == place[i][j+1].getText())
{
counter++; //counter = 2 here
if (place[i][j+1].getText() == place[i][j+counter].getText())
{
counter++; //counter = 3 here
if (place[i][j+counter].getText() == place[i][j+counter+1].getText())
{
counter++; //counter = 4 here
if (place[i][j+counter].getText() == place[i][j+counter+1].getText())
{
counter++; //counter = 5 here
// call the DeleteFromBoard function here
deletedLines++;
System.out.println(deletedLines);
}
else counter=1;
}
}
}
}
}
System.out.println("\n\n End of Program");
}
}