这是我正在使用的代码。此处引用的其他类已经过测试并且可以正常工作,但它们不应影响此处语句的功能。
import java.util.Scanner;
public class TransferTest
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
double transferAmount;
Account acct1 = new Account(100, null);
Account acct2 = new Account(100, null);
System.out.print("Choose an option: "
+ "\n1 <Enter>: to transfer from account 1 to account 2"
+ "\n2 <Enter>: to transfer from account 2 to account 1"
+ "\n3 <Enter>: to quit");
int userOption = scan.nextInt();
scan.nextLine();
while(userOption != 3);
{
if (userOption == 1)
{
System.out.print("You chose transfer …Run Code Online (Sandbox Code Playgroud)