调用Webserice为什么会报这个错?哪里写的不对吗?

为什么编译时会报这样的错???

06-07

我用eclipse编译以下代码,编译器就会报错,不知道是怎么一回事rn代码如下:rnrnpackage p426_I_O_stream;rnrnimport java.io.*;rnpublic class IOStreamDemo rn // throw exceptions to console:rn public static void main(String[] args) throws IOException rn // 1. reading input by lines:rn BufferedReader in = new BufferedReader(rn new FileReader("IOStreamDemo.java"));rn String s, s2 = new String();rn while((s = in.readLine()) != null);rn s2 += s + "\n";rn in.close();rn rn // 1b. reading standard input:rn BufferedReader stdin = new BufferedReader(rn new InputStreamReader(System.in));rn System.out.print("Enter a line:");rn System.out.println(stdin.readLine());rn rn // 2. Input from memory:rn StringReader in2 = new StringReader(s2);rn int c;rn while((c = in2.read()) != -1);rn System.out.print((char)c);rn rn // 3. format memory input:rn try rn DataInputStream in3 = new DataInputStream(rn new ByteArrayInputStream(s2.getBytes()));rn while(true)rn System.out.print((char)in3.readByte());rn catch(EOFException e) rn System.err.println("End of Stream");rn rn rn // 4. file output:rn try rn BufferedReader in4 = new BufferedReader(rn new StringReader(s2));rn PrintWriter out1 = new PrintWriter(rn new BufferedWriter(rn new FileWriter("IODemo.out")));rn int lineCount = 1;rn while((s = in4.readLine()) != null)rn out1.println(lineCount++ + ": " + s);rn out1.close();rn catch(EOFException e) rn System.err.println("End of stream");rn rn rn // 5. storing & recovering datarn try rn DataOutputStream out2 = new DataOutputStream(rn new BufferedOutputStream(rn new FileOutputStream("Data.txt")));rn out2.writeDouble(3.14159);rn out2.writeChars("that was pi\n");rn out2.writeBytes("that was pi\n");rn out2.close();rn DataInputStream in5 = new DataInputStream(rn new BufferedInputStream(rn new FileInputStream("Data.txt")));rn BufferedReader in5br = new BufferedReader(rn new InputStreamReader(in5));rn // must use DataInputStream for data:rn System.out.println(in5.readDouble());rn // can now use the "proper" readLine():rn System.out.println(in5br.readLine());rn // but the line comes out funny.rn // the one created with writeBytes is ok:rn System.out.println(in5br.readLine());rn catch(EOFException e) rn System.err.println("end of stream");rn rn rn // 6. reading/writing random access filesrn RandomAccessFile rf = new RandomAccessFile("rtest.dat","rw");rn for(int i = 0; i < 10; i++)rn rf.writeDouble(i*1.414);rn rf.close();rn rn rf = new RandomAccessFile("rtest.dat","rw");rn rf.seek(5*8);rn rf.writeDouble(47.0001);rn rf.close();rn rn rf = new RandomAccessFile("rtest.dat","rw");rn for(int i = 0; i < 10; i++)rn System.out.println("Value" + i + ": " + rf.readDouble());rn rf.close();rn rnrn----------------------------------------------------------------------rnrn报错如下:rnrnjava.io.FileNotFoundException: IOStreamDemo.java (系统找不到指定的文件。)rn at java.io.FileInputStream.open(Native Method)rn at java.io.FileInputStream.(FileInputStream.java:103)rn at java.io.FileInputStream.(FileInputStream.java:66)rn at java.io.FileReader.(FileReader.java:41)rn at p426_I_O_stream.IOStreamDemo.main(IOStreamDemo.java:9)rnException in thread "main"

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭