gpt4 book ai didi

java - 找不到符号 InputStreamer

转载 作者:行者123 更新时间:2023-11-29 06:38:54 26 4
gpt4 key购买 nike

import java.io.*;
public class MgSq
{
public static BufferedReader input = new BufferedReader(new
public
InputStreamer(System.in));
public static void main (String args[]) throws Exception
{

int w, x, y, z, b, key;
boolean n_ok;
int [] [] square = new int [15] [15];
{
System.out.print("Size of square? ");
b = Integer.parseInt(input.readLine());
n_ok = (z<=b) & (b<=15+1) & (b%2==1);
if ( n_ok )
{
for (w=0;w<b;w++)
for (x=0;x<b;x++) square[w][x] = 0;
square[0][(int)(b-1)/2] = 1;
key = 2;
w = 0;
x = (int)(b-1)/2;
while ( key <= b*b )
{
y = w - 1;
if ( y < 0 ) y = y + b;
z = x - 1;
if ( z < 0 ) z = z + b;
if ( square[y][z] != 0 ) w = (w+1) % b;
else
{
w = y; x = z;
}
square[w][x] = key;
key = key + 1;
}
System.out.println("Magic square of size " + b);
for (w=0;w<b;w++)
{
for (x=0;x<b;x++)
System.out.print("\t"+square[w][x]);
System.out.println();
}
}

}
System.out.println("Error in number, try again.");
}
}

我不断收到以下错误:

MgSq.java:4 error: cannot find symbol 
public static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

symbol: class InputStreamer
class: MgSq

最佳答案

因为您只导入了 java.io.*InputStreamer 可能是一个拼写错误,您希望改用 InputStream

关于java - 找不到符号 InputStreamer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15478960/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com