更换了JRE设置,突然报了好多错,如:Type mismatch: cannot convert from long to Long之类
一个小程序 没写完 诸如此类 ,如果是JRE错误 怎么办?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class MatrixTrace {
public static void main(String[] args) throws IOException {
int n;
long sum=0;
System.out.print("进行数据输入:");
Scanner num=new Scanner(System.in);
n=num.nextInt();
String s[]=new String[n];
Scanner scan[]=new Scanner[n];
Long W[][]=new Long[n][n];
BufferedReader std=new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<n;i++) {
s[i]=std.readLine();
}
System.out.println("输入的数据为:");
for(int i=0;i<n;i++) {
scan[i]=new Scanner(s[i]);
}
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
W[i][j]=scan[i].nextLong();
}
}
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
System.out.print(W[i][j]+" ");
if (i==j) {
sum=sum+W[i][j];
}
}
System.out.println("");
}
System.out.println("he:"+sum);
}
}