File类有两个常用方法可以得到文件路径一个是:getCanonicalPath(),另一个是:getAbsolutePath(),可以通过File类的实例调用这两个方法例如file.getAbsolutePath()其中file是File的实例对象。下面是一个具体例子: public class PathTest{ publ...
分为读字节,读字符两种读法 ◎◎◎FileInputStream 字节输入流读文件◎◎◎ public class Maintest { public static void main(String[] args) throws IOException { File f=new File("G:\\just for fun\\xiangwei.txt"); FileInputStream fin=new Fi...
/** * 读取配置文件 */private Properties loadProperty() {Properties prop=new Properties();try {//FileInputStream is=new FileInputStream("config.properties");InputStream is=this.getClass().getResourceAsStream("/config.properties"...