
結(jié)論:
當(dāng)輸入為絕對(duì)路徑時(shí),返回的都是絕對(duì)路徑。
當(dāng)輸入為相對(duì)路徑時(shí):
getPath()返回的是File構(gòu)造方法里的路徑,是什么就是什么,不增不減
getAbsolutePath()返回的其實(shí)是user.dir+getPath()的內(nèi)容,從上面F:\eclipseworkspace\testejb、F:\eclipseworkspace\testejb\..\src\test1.txt、F:\eclipseworkspace\testejb\.\test1.txt可以得出。
getCanonicalPath()返回的就是標(biāo)準(zhǔn)的將符號(hào)完全解析的路徑