String path="/qh/cic/复习";
void test() throws Exception{
URL url=getClass().getResource(path);
File file=new File(url.toURI());
System.out.println(file.getPath());
System.out.println(file.getAbsolutePath());
}
此时两句打印的结果相同,请教各位前辈,getPath()和getAbsolutePath()有什么区别呢 ? 什么时候用他们更合适呢 ?