public class InOutDemo {
public static void main(String[] args) throws Exception {
System.out.println(new File(".").getAbsolutePath());
InputStream is = new FileInputStream("g:\\1.txt");
//InputStream is = new FileInputStream(".\\src\\cn\\linson\\io\\2.txt");
//InputStream is = new FileInputStream(".\\config.properties");
int len = 0;
byte[] b = new byte[10];
while((len = is.read(b))!= -1){
for(byte bb:b){
System.out.print((char)bb+" ");
}
}
}
}
1,绝对路径
2,相对路径 2.txt在包下
3,config文件在工程根目录下