“令牌上的语法错误”;“,此令牌后预期的原语类型”是我在这条语句"String data = input.next(); "
上的分号后得到的消息,我不知道为什么。令牌上的语法错误“;”在Java
import java.util.*;
public class PorterHouse {
public static void main(String[] args){
System.out.println("enter interest rate, loan mount, and number of years: ex. "+
" 7.9-400000-5");
Scanner input = new Scanner(System.in);
String data = input.next();
[] b = data.split("[-]");
double interstRate = Double.parseDouble(b[0]);
double loanPrincipal = Double.parseDouble(b[1]);
double loanLength = Double.parseDouble(b[2]);
double monthlyPayment = (b[1]*b[2]/1);
double totalPayment = (monthlyPayment * loanLength * 12);
System.out.println("Monthly Pament: " + monthlyPayment);
System.out.println("totalPayment: " + totalPayment);
}
}
'''b''没有数据类型。 –