BufferedReader readTxt=new BufferedReader(new FileReader(new File("text.txt")));
String textLine="";
String str="";
while(( textLine=readTxt.readLine())!=null){
str+=" "+ textLine;
}
String[] numbersArray=str.split(" ");
//numbersArray下保存的即为各个数字
java读取txt中用空格隔开的数字
最新推荐文章于 2024-06-22 18:40:21 发布