Java .class是预期的

时间:2012-08-18 07:37:37

标签: java

  

可能重复:
  Trying to invoke a method called addAccount for a bank application but it keeps giving me .class is expected error

我正在尝试为银行申请分配学校作业。它应该有addAccount方法,并从2个数组中获取2个参数; accountNumber和accountBalance分别。我试图将accountNoArray输入到addAccount方法中,但是当我这样做并调用它时,它表示.class是预期的错误

import java.util.*;
public class bank
{
public static void main(String[]args)
{
    Scanner sc = new Scanner(System.in);
    int choice = 0;
    int accountNo = 0;
    double accountBal = 0;
    int[] accountNoArray = new int[20];
    double[] accountBalArray = new double[20];
    displayMenu();
    System.out.print("Please Enter Your Choice: ");
    choice = sc.nextInt();
    switch(choice)
    {
        case 1 : addAccount(accountNo,accountBal,sc); break;
    }
}

public static void displayMenu()
{
    System.out.println("Menu");
    System.out.println("1. Add an account");
    System.out.println("2.Search an account with the given account number");
    System.out.println("3.Display accounts below the given balance");
    System.out.println("4.Exit");
}   

public static void addAccount(int accountNo,double accountBal,Scanner sc)
{
    System.out.print("Please Enter NRIC Number: ");
    accountNo = sc.nextInt();
    System.out.print("Please Enter Account Balance: ");
    accountBal = sc.nextInt();
}
}

0 个答案:

没有答案