在編譯下面的代碼我有錯誤重寫方法斜面拋出異常
@Override
public void routeCustomerRequest (int choice) throws UnSupportedCustomerRequestException{
//throw new UnsupportedOperationException("Not supported yet.");
switch(choice)
{
case '1':
System.out.println("1. Add a new Customer");
break;
default :
throw UnSupportedCustomerRequestException("hehehe");
}
}
// its constructor class is
public class UnSupportedCustomerRequestException extends Exception {
public UnSupportedCustomerRequestException(String bong){
System.out.println(bong);
}
}
它的界面
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package bankingappication;
/**
*
* @author Training
*/
public interface IBankingServices {
public static String bankerResgistrationCode=null;
public void enquireCustomer();
public int presentServiceMenu();
public void routeCustomerRequest(int choice);
public boolean acceptDeposit();
public boolean acceptCheque();
public boolean processCheque();
//customer name can be full or partial.
public boolean provideSummaryStatement(String customerName);
public boolean addCustomer();
public boolean removeCustomer();
public boolean updateCustomer();
}
//please debug the error
我已編輯的程序更廣泛的,你認爲問題仍然存在 – hemanth
是它應該。重新閱讀我的答案 –