//在用于接受用户输入时,只能用byte,不能用char?
import java.io.*;
public class aa
{
public static void main(String args[]) throws IOException
{ byte aa[]=new byte[10]; //换成 char aa[]=new char[10]会出错,WHY?
int count=System.in.read(aa);
}
}
import java.io.*;
public class aa
{
public static void main(String args[]) throws IOException
{ byte aa[]=new byte[10]; //换成 char aa[]=new char[10]会出错,WHY?
int count=System.in.read(aa);
}
}
{
public static void main(String args[]) throws IOException
{
char aa[]=new char[10];
int i;
for(i=0;i<10;i++)
{
aa[i]=(char)(64+i);
}
for(i=0;i<10;i++)
{
System.out.print(" "+aa[i]);
}
}
}
char ch[] = new char[10];Reader r = new Reader(new InputStreamReader(System.in));
int count = r.read(ch);
读取操作有通过字节流的如System.in.read(byte[])
也有读取字符流的
你可以查一下api文档
System.in.read 构造方法没有传char[]值的,所以不能用啊