首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

得到键盘输入字符有关问题

2012-01-01 
得到键盘输入字符问题请问一下应该怎么实现得到键盘输入字符我用system.in.read()得到的是一个INT数据我需

得到键盘输入字符问题
请问一下应该怎么实现得到键盘输入字符
我用system.in.read()得到的是一个INT数据
我需要得到STRING型,然后写入数组
String[][][]   person   =   new   String[10][3][1];
for   (int   i   =   0;   i   <=   9;   i++)
{
System.out.println( "enter   the   student   name: ");
String   a   =   System.in.read();       //这里出错
for   (int   j   =   0;   j   <=   2;   j++)
{
for   (int   k   =   0;   k   <   1;   k++)
{

}
}
}

[解决办法]
InputStreamReader in =new InputStreamReader(System.in);
BufferedReader buffin=new BufferedReader(in);
String strIn = " ";
try{
strIn=buffin.readLine();
}
catch(IOException e)
{
System.out.println(e.toString());
}

热点排行