I am kinda confuse with this piece of code. It keeps give me the error of "Deferencing Null Pointer".
bookStore.java
@Override
protected store createOutlet (String storeName, String storeType) {
store theStore = null;
theStore.setStoreName(storeName); //getting Deferencing Null Pointer Error
theStore.setStoreType(storeType);
return theStore;
}
storeProducer.java
public abstract class storeProducer {
protected abstract store createOutlet(String storeName, String storeType);
public store createNewStore(String storeName, String storeType) {
store newStore = createOutlet(storeName, storeType);
newStore.createStore();
return newStore;
}
store.java
public abstract class store extends Observable {
abstract void createStore();
What the problem in it? I already tried like throwing the exception but still not working.