1
錯誤是:字符串不== =撤回,無論我放,它只會說,存款。 我想能夠使用(撤回)&(存款)。代碼將不會輸出正確的字符串
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?");
}
}
}
日Thnx :),工作完美。 – 2014-09-25 14:28:14