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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -