An enclosing instance that contains is required

前端 未结 3 1393
花落未央
花落未央 2020-11-30 04:47

An enclosing instance that contains is required

Below is the code. positionObj is the object that I am trying to use and i

3条回答
  •  余生分开走
    2020-11-30 04:56

    The correct generic signature would be

    public static HashMap main(String vArg)
    

    you dont need to qualify positionObj since you already import it.

    However, I am pretty sure a main method must conform to the signature below. If you intend to have main be the main method for your program, change the signature to

     public static void main(String[] args) {...}
    

    you can create a separate static method that returns a Map and invoke it from main.

    As a note, all classes should begin with a capital letter, positionObj, should be PositionObj.

提交回复
热议问题