I am writing an ATM program and when the user inputs one of the string values the program should check it an do a method accordingly. The problem code is here:
System.out.println("PRESS");
            System.out.println("(D)eposit");
            System.out.println("(W)ithdraw");
            System.out.println("(C)heck Account Balance");
            System.out.println("(Q)uit");
            System.out.println("Enter Choice: ");
            String choice = scanner.nextLine();
            scanner.nextLine();
            if(choice == "D"){
                currentCustomer.deposit();
            }
            else if(choice == "W"){
                currentCustomer.withdraw();
            }
            else if(choice == "C"){
                currentCustomer.checkBalance();
            }
            else if(choice == "Q"){
                currentCustomer.quit();
            }
            else{
                System.out.println("Invalid choice please reenter: ");
            }
If a user enters in "D" the program skips to the else statement. I know when using .nextLine you have to use two because of the return character but I'm not sure if that is true with this case. Either way if I have the extra .nextLine statement or not it still skips ahead. Any help would be much appreciated!
 
     
     
     
    