简体   繁体   English

ABC.methodname(); 作为令牌“方法名称”的语法错误,此令牌后应有标识符

[英]ABC.methodname(); as Syntax error on token “methodname”, Identifier expected after this token

  • I am new to java. 我是Java新手。
  • I am getting an error at this line ABC.methodname(); 我在此行ABC.methodname()遇到错误; as Syntax error on token "methodname", Identifier expected after this token. 作为令牌“方法名称”的语法错误,此令牌后应有标识符。
  • can you guys tell me how to fix it. 你们能告诉我如何解决吗?
  • providing my whole code below. 在下面提供我的整个代码。
    ABC.methodname();

    //ABC.jumpDepositsRecords();

     private static final String AutomaticDeposit_TransferWebServiceClient = 

You are calling a method in the section where attributes of a class are defined... There's a few options here depending on what you are required to do. 您正在定义类属性的部分中调用方法。根据您需要执行的操作,这里有一些选项。

  1. Create a constructor and call it in there. 创建一个构造函数并在那里调用它。
  2. Assign something to ABC.methodName such as: private DFG = ABC.methodname(); 为ABC.methodName分配一些内容,例如:private DFG = ABC.methodname();
  3. Perhaps, create a Main method where you call the ABC.methodname() 也许创建一个Main方法,在其中调用ABC.methodname()

You have a class ABC with a method methodname() , and you want to call that method from another class. 您有一个带有方法methodname()的类ABC ,并且您想从另一个类中调用该方法。

So, you have to do the functions like object initialisation inside the main method, like: 因此,您必须在main方法内部执行诸如对象初始化之类的功能,例如:

public static void main(String[] args) {
    ABC method = new ABC();
}

Look through your code for your com.sports.jump.laptop.batch.dao.PlayerCatchBallVO class again. 再次通过代码查找com.sports.jump.laptop.batch.dao.PlayerCatchBallVO类。 Are you sure that methodName is a function, not a field? 您确定methodName是函数而不是字段吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM