method issue in java
java, methods
Solution
remove return type from
public void MyPoint(int x, int y)
constructor cannot have return type not even `void`
make it
public MyPoint(int x, int y)
{
this.x = x;
this.y = y;
}
Problem
i'm learning to create custom classes and can't figure out where I've gone wrong From main class... `MyPoint p1 = new MyPoint(317, 10);` the error says: ``` constructor MyPoint in class MyPoint cannot be applied to given types; required: no arguments found: int, int reason: actual and formal argument lists differ in length ``` this is from my MyPoint class: `private int x, y;` ``` public void MyPoint(int x, int y) { this.x = x; this.y = y; } ``` Why isn't MyPoint(317, 10) being fed into the relevant class along with the x and y values? Any help would be appreciated, thank you.