Hi, I've only been java'ing for a few months and am struggling with the latest assignment. I'd be really grateful if anyone could help. I need to print a two dimensional boolean array substituting a char for the true or false thereby creating a pattern. For now I just want to print the table but am getting a nullPointerException. Here is my code:
/** * An instance method to print the table with '.' to represent the false and * 'O' to represent the true boolean values from the array */ public void display() { for(int j = 0; j < FONT_LETTER_HEIGHT; j++) { for(int i = 0; i < FONT_LETTER_WIDTH*FONT_LETTER_DISPLAY; i++) { if(table[j][i]) { System.out.print('.'); } else { System.out.print('O'); } System.out.print(table); } System.out.println(); } System.out.println(); }
I had also created a char that I used as '.' and 'O' in the if statements, but that got the same error! Could anyone please suggest a way that I could get this to work?
Thank you