Java Newbie pytanie: jaka jest różnica między getAbsolutePath() i getcanonicalPath() w klasie plików. Nie mogę odczytać znaczenia z dokumentów. w poniższym kodzie ich wydajność jest taka sama.Jaka jest różnica między getAbsolutePath i getCanonicalPath
public class copyFile {
public static void main(String[] args) throws IOException {
File inputFile = new File("/home/kit.ho/");
System.out.println("get AbsolutePath");
System.out.println(inputFile.getAbsolutePath());
System.out.println("get CanonicalPath");
System.out.println(inputFile.getCanonicalPath());
}
}
możliwy duplikat [Jaka jest różnica między getPath(), getAbsolutePath() i getCanonicalPath() w Javie?] (Http://stackoverflow.com/questions/1099300/whats-the-difference-between-getpath- getabsolutepath-i-getcanonicalpath) –
absoulet ścieżka daje całą drogę na przykład/user/login/nameoffolder/txt podczas stożkowy ścieżka jest jak nameoffolder/txt (zawiadomienie nie ma/przed nameoffolder) nadzieję, że pomoże –
[Avajava] (http: //www.avajava.com/tutorials/lessons/whats-the-difference-between-a-files-path-absolute-path-and-canonical-path.html) ma dość dobre wyjaśnienie różnic ... –