[求助]怎么读取从键盘中输入的字符并且读取到数组中,请用代码实现
[求助]怎么读取从键盘中输入的字符并且读取到数组中,请用代码实现
----------------解决方案--------------------------------------------------------
import java.io.*;
public class read{
public static void main(String[] args){
String[] str=new String[100];
while(index<100)
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
str[i]=in.readLine();
}catch(Exception e){
e.printStackTrace();
}
index++;
}
----------------解决方案--------------------------------------------------------
import java.io.*;
public class read{
public static void main(String[] args){
String s="";
char[] Array;
String s1="";
while(!s1.equals("#"))
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
s1=in.readLine();
s+=s1;
}catch(Exception e){
e.printStackTrace();
}
System.out.println(s);
Array=s.toCharArray();
}
}
----------------解决方案--------------------------------------------------------