「令牌上的語法錯誤」;「,此令牌後預期的原語類型」是我在這條語句"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''沒有數據類型。 –