Exception in thread "main" java.lang.NullPointerException (JDBC) -
exception in thread "main" java.lang.nullpointerexception @ gui.cataloguepanel.(cataloguepanel.java)
i'm trying initialize bookquery
object in cataloguepanel
, call getbooklist()
cataloguepanel.java
package gui; import java.util.arraylist; import backend.book; import backend.bookquery; // catalog panel. shows library titles' information , allows users place orders. public class cataloguepanel extends jpanel implements gbpanel { bookquery bquery; arraylist<book> booklist = bquery.getbooklist(); // here's error occurred }
edit: http://www.reactionface.info/sites/default/files/imagecache/node_page/images/1314029819767.png
bookquery bquery; arraylist<book> booklist = bquery.getbooklist();
bquery
not initialized, similer null.getbooklist()
must produce nullpointerexception
. either initialize bquery
. -
bookquery bquery= new bookquery();
or make getbooklist()
method static
, call method -
arraylist<book> booklist = bookquery.getbooklist();
Comments
Post a Comment