Constructor cannot be applied to given types?

前端 未结 3 1468
青春惊慌失措
青春惊慌失措 2021-01-13 15:50

I have the following Java code:

public class WeirdList {
    /** The empty sequence of integers. */
    /*ERROR LINE */ public static final WeirdList EMPTY =         


        
3条回答
  •  无人及你
    2021-01-13 16:48

    When you call any method the call and callie must match parameters and return type. Special case with constructors is if you don't make one the compiler will insert a blank constructor void Weird(){} you can overload a class and have many constructors, the one that will execute is the one with the same signature ie types.what you are trying is to do something built into java already in the LinkedList, Vector, List java class.

提交回复
热议问题