以行为单位调整为倒序排列
Thisisasampletext!这是测试文本。Thisisasampletext!这是测试文本。这是测试文本。Thisisasampletext!这是测试Thisis...
This is a sample text!
这是测试文本。
This is a sample text!这是测试文本。
这是测试文本。This is a sample text!
这是测试This is a sample text!文本。
This is a 这是测试文本。sample text!
This 是 is 测 a 试 sample text!
用Java程序编写 展开
这是测试文本。
This is a sample text!这是测试文本。
这是测试文本。This is a sample text!
这是测试This is a sample text!文本。
This is a 这是测试文本。sample text!
This 是 is 测 a 试 sample text!
用Java程序编写 展开
1个回答
展开全部
import java.io.*;
public class Sort{
public static void main(String[] args) throws IOException {
FileReader in = null;
FileWriter out = null;
BufferedReader read;
BufferedWriter write;
String temp[] = new String[100];
try {
in = new FileReader("A.txt");
out = new FileWriter("B.txt"); }
catch (FileNotFoundException e) { System.out.println("未找到文件");}
read = new BufferedReader(in);
write = new BufferedWriter(out);
String source;
int index = 0;
while((source = read.readLine()) != null){
temp[index] = source + "\n";
index++;
}
read.close();
for(int i=index-1; i>=0; i--){
write.write(temp[i]);
write.newLine();
write.flush();
}
write.close();
}
}
public class Sort{
public static void main(String[] args) throws IOException {
FileReader in = null;
FileWriter out = null;
BufferedReader read;
BufferedWriter write;
String temp[] = new String[100];
try {
in = new FileReader("A.txt");
out = new FileWriter("B.txt"); }
catch (FileNotFoundException e) { System.out.println("未找到文件");}
read = new BufferedReader(in);
write = new BufferedWriter(out);
String source;
int index = 0;
while((source = read.readLine()) != null){
temp[index] = source + "\n";
index++;
}
read.close();
for(int i=index-1; i>=0; i--){
write.write(temp[i]);
write.newLine();
write.flush();
}
write.close();
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询