Getting this exception while running following program
Exception in thread "main" java.lang.NullPointerException
at pojo.Bill.main(Bill.java:20)
Java Result: 1
Bill.java
public class Bill {
public static void main(String s[]){
Bill b=new Bill();
b.getBillDetails().setBillNo(444);// line 20
System.out.println("bill no "+ b.getBillDetails().getBillNo());
}
private BillAction billDetails;
public BillAction getBillDetails() {
return billDetails;
}
public void setBillDetails(BillAction billDetails) {
this.billDetails = billDetails;
}
In BillAction there is getter and setter of billNo How to resolve this.