1

The Error is that: String which doesn't == withdraw, whatever i put, it will just say, deposit. i want to be able to use both (withdraw) & (Deposit).

import java.util.Scanner;

public class BasicClasses {
    public static void main(String[] args) {
        System.out.println("Welcome to First National Bank (FNB)");
        Scanner Key = new Scanner(System.in);
        String Question = Key.nextLine();
        BasicClasses flix = new BasicClasses();

        System.out.print(" | Withdraw | or | Deposit | [ ");
        Scanner Key1 = new Scanner(System.in);
        String Which = Key.nextLine();

        if(Which == "withdraw") {
            System.out.println("|Withdraw| - | How much do you Want to Withdraw?");

        } else {
            System.out.println("|Deposit| - | How much will you be Depositing?");
    }


}

}

Leigh Flix
  • 218
  • 2
  • 8

1 Answers1

0

compare like this : if(Which.equals("withdraw"))

Rustam
  • 6,485
  • 1
  • 25
  • 25