package bianchengti03;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
/*键盘录入数据,保存到文本文件中
要求:
键盘录入数据,以"over"结束
将录入的内容转成大写字母,保存到文本 text.txt中
每录入一行,就要向文本中写出一行`
*/
public class Test {
public static void main(String[] args) throws Exception {
BufferedWriter bw = new BufferedWriter(new FileWriter("text.txt"));
Scanner sc =new Scanner (System.in);
while(1<2){
String s= sc.next();
//boolean b = c1.endsWith("over");
if("over".equals(s)){
break;
}
String c1 = s.toUpperCase();
bw.write(c1);
bw.newLine();
}
bw.close();
}
}
|
|