当我尝试将方法调用到我的main函数时,我一直收到错误

时间:2017-10-23 06:08:56

标签: java

  

此功能的目标是获取呼叫中心环境中代理的代理状态

package avaya_connection;  

公共类Avaya_Connection {

     public void agentUpdate(Agent agentState)//checking agent state 
     {
        agentState.getAgentID();
          int previousAgentState = LucentAgent.UNKNOWN;/*the previous state 
          will by default be unknown*/

    if (agentState.getState() == previousAgentState)//getting the agent state
        return ;

    previousAgentState = agentState.getState();


    String msg = "AgentState: ";
    switch (previousAgentState) {//switch statement to find the current agent state

    case Agent.LOG_OUT:
        System.out.println("Agent is logged out");
        break;

    case Agent.READY://agent state returns ready
        System.out.println("Agent is ready");
        break;

    case Agent.NOT_READY://agent state returns not read
        System.out.println("Agent is not ready");
        break;

    case Agent.WORK_NOT_READY:
        System.out.println("Agent work not ready");
        break;

    case Agent.BUSY:
        System.out.println("Agent is busy");
        break;

    default:
        // Received an event which is not to be processed.

     }

     public static void main(String[] args) 
     {

             Avaya_Connection ac = new Avaya_Connection();
             ac.agentUpdate(agentState);/*calling the method of checking 
             agent states*/


     }
}
  • 列表项

返回的错误是找不到符号,并且当它留空时需要parm

2 个答案:

答案 0 :(得分:0)

要调用实例的方法,首先需要声明并实例化它。

Avaya_Connection ac = new Avaya_Connection();

参数

也是如此
Agent agentState = new Agent();

然后你可以调用方法并正确传递参数。

ac.agentUpdate(agentState);

除非是静态的,否则不能在没有实例的情况下调用方法。

答案 1 :(得分:-1)

首先需要声明并实例化它。

Avaya_Connection ac = new Avaya_Connection();

Agent a = new Agent();

然后按如下方式调用您的方法。

ac.agentUpdate(a);