Coding error when importing project to another computer
我有一个项目,我创建的工作完美,没有任何错误,在家里做。然而,当我把这个项目导入学校的计算机时,我从两个不同的类中得到了两个代码错误。
第一误差
主类
1 |
Illegal start of type ) expected;
Illegal start of expression ; expected;
第二误差
BankProcess类
1 | bankAccounts.remove(bankAccount.getAccountId(), bankAccount); |
No suitable methods found for remove....
我可以这样吗?家庭计算机上不会出现此类错误。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package Coursework1; import java.util.*; public class Bank { //Creates a new treemap in which Bank Accounts will be stored in. private TreeMap < Integer, BankAccount > bankAccounts = new TreeMap < Integer, BankAccount > (); //This method returns all bank accounts in the treemap. public TreeMap < Integer, BankAccount > getAccounts() { return bankAccounts; } //This method adds a bank account to the treemap. public void setAccounts(TreeMap < Integer, BankAccount > accounts) { this.bankAccounts = accounts; } //This method return a bank account using the account number. public BankAccount getAccount(Integer accountNumber) { return bankAccounts.get(accountNumber); } //This method removes a bank account from the treemap. public void removeAccounts(TreeMap < Integer, BankAccount > accounts) { this.bankAccounts = accounts; } } |
据我所知,在Java 7和更早的版本中不支持像您这样的FURACH语句(lambda表达式)。所以我猜学校计算机没有安装Java 8。
你在家和SDK8一起工作,你的学校也有SDK7。这就是SDK7不支持SDK8表达式的原因。