Getting a Null Pointer Exception that I dont understand since Im new to java.
package com.atm;
import com.atm.IUserAction.ActionType;
/**
* The ATM implementation class.
*
* @author mshields
*
*/
public class AtmImpl {
private static final IAtmHelper ATM = AtmUtils.getAtmHelper();
/**
* This method is invoked when a bank card is inserted into the ATM. The card
* is ejected immediately upon completion of this method, which represents the
* user's ATM session.
*
* @param args
* the bank card number is the only argument.
*/
public static void main(String args[]) {
IUserAction pinResponse = ATM.getUserResponse("Please enter your 4-digit PIN.", ActionType.STRING);
the last line is where im getting the error. I thought it is initialized when I said
private static final IAtmHelper ATM = AtmUtils.getAtmHelper();
the IAtmHelper is basically empty:
public class AtmUtils {
public static IAtmHelper getAtmHelper()
{
// this dummy impl is just included to satisfy compile-time errors
return null;
}
}
here is the top of the ATMHelper class that is used:
package com.atm;
import java.math.BigDecimal;
import java.util.List;
import com.atm.IUserAction.ActionType;
/**
* Interface that defines ATM utility methods.
*
* @author mshields
*
*/
public interface IAtmHelper {
here is the function
public IUserAction getUserResponse(String argMessage,
ActionType... argValidActionTypes);
they dont really do anthing since this isnt a real porject, but more like a test. I understand how to do all of it basically, but i cant get around this null pointer in the beginning of the main. thanks