输出问题
import java.io.*;public class IOStreamdemo{
public static void main(String [] args)throws IOException{
BufferedReader in=
new BufferedReader(
new FileReader("IOStreamdemo.java"));
String s ,s2=new String();
while((s=in.readLine())!=null)
s2+=s+"\n";
System.out.println(s2);
in.close();
BufferedReader stdin=
new BufferedReader(
new InputStreamReader(System.in));
System.out.println(stdin.readLine());
StringReader in2=new StringReader(s2);
int c;
while((c=in2.read())!=-1)
System.out.print((char)c);
DataInputStream in3=
new DataInputStream(
new ByteArrayInputStream(s2.getBytes()));
while(in3.available()!=0)
System.out.print((char)in3.readByte());
try{
BufferedReader in4=
new BufferedReader(
new StringReader(s2));
PrintWriter out1=
new PrintWriter(
new BufferedWriter(
new FileWriter("E/IODemo.txt")));/*这有问题*/
int linecount=1;
while((s=in4.readLine())!=null)
out1.println(linecount++ + ":" +s);
out1.close();
}catch(EOFException e){
System.out.println("end of stream");
}
}
}
我想把他输入到e下的IODemo.txt的文件中怎么弄啊 如果是写成IODemo.txt 他直接就放在了当前目录下了 我初学java不懂啊.