答案 0 :(得分:0)
不要创建三个变量Scanner
。只需使用其中一个并使用input.nextLine();
input
,Scanner
类型的变量String
。然后,您可以将其存储在三个import java.util.Scanner;
public class CurrencyConverter
{
public static void main(String [ ] args)
{
Scanner input = new Scanner(System.in);
String pesos;
System.out.println("What is the current exchange rate for pesos to dollars?");
pesos = input.nextLine();
String yen;
System.out.println("What is the current exchange rate for yen to dollars?");
yen = input.nextLine();
String euros;
System.out.println("What is the current exchange rate for euros to dollars?");
euros = input.nextLine();
}
}
变量中。
{{1}}