试试这个, 要把最后的回车去掉.
for(int i=0;i<10;i++)
{
System.out.print("enter "+(i+1)+ " letter:");
try {
ch[i]=(char)System.in.read();
do{
int c = System.in.read();
}while(System.in.available()>0) ;
}catch(IOException e){};
}
for(int i=0;i<10;i++)
{
System.out.print("enter "+(i+1)+ " letter:");
try {
ch[i]=(char)System.in.read();
do{
int c = System.in.read();
}while(System.in.available()>0) ;
}catch(IOException e){};
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货