0

my code is like

public class StationService 
{
private  StationDao stationDao;

public StationService(StationDao stationDao) {
     this.stationDao = stationDao;
}

public void insertData(PoliceStationBeans beans) {
    // TODO Auto-generated method stub
    System.out.println("In Implementation:"+beans.getArea()+""+beans.getUserName()
            +""+beans.getPassword()+""+beans.getEmail());

     stationDao.insertData(beans); //Getting Error Here
}
}

How to resolve this error I reffered this question Can i call a method which is inside an interface without implementing the interface?

Community
  • 1
  • 1
Vishal Kawade
  • 449
  • 6
  • 20
  • 1
    You are either constructing `StationService` with a null `StationDao`; or you are somehow setting `stationDao` to null post construction; or the NPE actually occurs inside the implementation of `StationDao.insertData`. – Andy Turner Oct 14 '16 at 09:17
  • while calling insertData(beans) method – Vishal Kawade Oct 14 '16 at 09:30

0 Answers0