3
所以我想输入点的两个坐标到数组中。对不起,如果这是离开,我很困惑。将值输入到点数组中?
//create array of 100 coordinate points
//Excerpt from Main
Point[] A = new Point[100];
Scanner in = new Scanner(System.in);
System.out.println("Enter index: ");
int i = in.nextInt(); //validate
System.out.print("Enter integers x, y to replace: ");
A[i].input(in);
...
public class Point {
int x, y;
Point(int x, int y) {
throw new UnsupportedOperationException("Not supported yet.");
}
void input(Scanner sc){
x = in.nextInt();
y = in.nextInt();
}
}
感谢您的回复,但我仍然迷失。我收到了错误“线程中的异常”main“java.lang.UnsupportedOperationException”,我更新了帖子以添加我的Point.java。 – Joe123
没关系,我想我明白了。谢谢 – Joe123