java程序中的编译错误

java程序中的编译错误,java,Java,我写了以下程序,程序抛出编译错误 我不知道为什么会出现错误,因为所有的分号和括号似乎都放好了 import java.io.*; public class Solution { public static void main(String args[]) throws Exception { long coords[5000][2]; long number; BufferedReader br = new BufferedReader(new InputStrea

我写了以下程序,程序抛出编译错误

我不知道为什么会出现错误,因为所有的分号和括号似乎都放好了

import java.io.*;

public class Solution {
  public static void main(String args[]) throws Exception {
    long coords[5000][2];
    long number;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    try {
      number = Long.parseLong(br.readline());  // take no of inputs
      //take all co ordinates and store it in 2d array
      for(long i=0;i<number;i++) {  
        coords[i][0] = Long.parseLong(br.readline());
        coords[i][1] = Long.parseLong(br.readline());
      }
    } catch(NumberFormatException e) {
      System.out.println("Number Format Exception:");
    }

    if(check_line(coords,number)) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }

  public boolean check_line(long coords[][], long limit) {
    long x;

    for(long i=0;i<no;i++) {
      x = coords[i][0];
      if(coords[x][0] == x)
      return true;
      else {
        coords[i][0] = coords[x][0];
        coords[x][0] = x;
      }
    }

    return false;
  }
}

这不是创建阵列的正确方法:

long coords[5000][2];
应该是:

long coords[][] = new long[5000][2];

请记住,为变量赋值时必须始终使用
=
符号。

这是不正确的语法,正确的语法是
long-coords[][]=new-long[5000][2]

似乎你把它和C的导数混淆了

我得到了答案…是如此愚蠢的错误有很多。readline()的大小写应为-readline()。check_line是一种非静态方法,在我看来是一种静态方法。请不要忘记接受答案:P
long coords[][] = new long[5000][2];