このNullPointerExceptionが発生します:
java.lang.NullPointerException
at ATM.isItValid(ATM.java:64)
at ATM.displayGreeting(ATM.java:59)
at Bank.runATM(Bank.java:90)
at Bank.displayBank(Bank.java:109)
at Bank.addAccount(Bank.java:52)
at Bank.displayBank(Bank.java:105)
at Bank.addAccount(Bank.java:52)
at Bank.displayBank(Bank.java:105)
at BankDriver.main(BankDriver.java:6)
このコードから:
public void displayGreeting() {
clearScreen();
System.out.println("Welcome to Bob's Friendly Bank\n");
do {
System.out.print("Enter card number: ");
currentCard = input.next();
System.out.print("Enter PIN: ");
currentPIN = input.next();
System.out.println(currentCard + currentPIN);
} while (!(isItValid()));
}
public boolean isItValid(){
boolean answer = false;
if(theBank.validCard(currentCard, currentPIN)) //Exception thrown here.
answer = true;
return answer;
}
なにが問題ですか?