import java.io.*;
public class InputExa
{ public static void main(String[] args)
{ int b;
byte tom[]=new byte[25];
try
{ File f=new File(" G:/java code/jackxu/src/BollTest.java");
FileInputStream in=new FileInputStream(f);
b=in.read(tom,0,25);
while(b!=-1)
{ String s=new String(tom,0,b);
System.out.println(s);
}
}
catch(IOException e)
{ System.out.println("File Read Error"+e);
} }}上面的程序从磁盘上读取文件,并把代码显示在屏幕上,但是运行时候报错:
File Read Errorjava.io.FileNotFoundException: G:\java code\jackxu\src\BollTest.java (文件名、目录名或卷标语法不正确。)后来 G:/java code/jackxu/src/BollTest.java改成BollTest.java还是报错,这个怎样改??
public class InputExa
{ public static void main(String[] args)
{ int b;
byte tom[]=new byte[25];
try
{ File f=new File(" G:/java code/jackxu/src/BollTest.java");
FileInputStream in=new FileInputStream(f);
b=in.read(tom,0,25);
while(b!=-1)
{ String s=new String(tom,0,b);
System.out.println(s);
}
}
catch(IOException e)
{ System.out.println("File Read Error"+e);
} }}上面的程序从磁盘上读取文件,并把代码显示在屏幕上,但是运行时候报错:
File Read Errorjava.io.FileNotFoundException: G:\java code\jackxu\src\BollTest.java (文件名、目录名或卷标语法不正确。)后来 G:/java code/jackxu/src/BollTest.java改成BollTest.java还是报错,这个怎样改??
看是否能找到这个文件?
前面多了一个空格!!!!