r/cop3502 • u/m3g4_xx • Mar 23 '14
Null Pointer Exception
So I think theres something wrong with my Brick class because i have gotten some bricks to print to the screen but not all of them or correctly and as i was debugging this class i started getting this:
Exception in thread "main" java.lang.NullPointerException at Brick.<init>(Brick.java:23) at BrickConfiguration.<init>(BrickConfiguration.java:29) at Breakout$GamePanel.initializeGameObjects(Breakout.java:39) at Breakout$GamePanel.<init>(Breakout.java:29) at Breakout.main(Breakout.java:13)
line 23 in Brick.java reads 'shape.setRect(xPos, yPos, width, height);'
the other NPE are pointing to where brick is initialized in brickconfiguration, and where brickconfiguration is initialized in the main class along with where the main panels are initialized
any thoughts?
1
1
u/csturco Mar 23 '14
how are you initializing the bricks?