I am practicing with Java, and I'm trying to build an constructor that takes in an int[] array, and an int.
public static App(int[] name, int n) {}
Now in my main(), I am trying to build a new object with the constructor, and I'm getting an error message.
public static void main(String[] args) {
int n;
int[] name = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
App app1 = new App(name, n);
}
The error message I'm getting back is:
"constructor App in class App cannot be applied to given types; required: no arguments; found: int[],int; reason: actual and formal argument lists differ in length"
Can someone please explain more about what this error means, and how can I correct my code?
staticmodifier.returntype and must not bestaticalso you dont want it to beprivate