我正在学习创建自定义类,无法弄清楚我出错的地方
从主班......
MyPoint p1 = new MyPoint(317, 10);
错误说:
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
Run Code Online (Sandbox Code Playgroud)
这是来自我的MyPoint类:
private int x, y;
public void MyPoint(int x, int y)
{
this.x = x;
this.y = y;
}
Run Code Online (Sandbox Code Playgroud)
为什么MyPoint(317,10)不与x和y值一起被送入相关类?
任何帮助将不胜感激,谢谢.