java问题,求代码

2025-01-03 07:51:27
推荐回答(2个)
回答1:

public void run(String filepath1, String filepath2)
{
File f1 = new File(filepath1);
File f2 = new File(filepath2);
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
FileOutputStream fos = new FileOutputStream(f2);
String tmp;
while((tmp = br.readLine()) != null) {
fos.write(tmp.toUpperCase().getBytes());
}
fos.close;
fr.close();

}

回答2:

public String test(){ //String 代表方法返回值为String return "sss";//因为方法定义返回值为String,所以return要返回字符串}