This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes getCanonical, Absolute, Path in File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "getCanonical, Absolute, Path in File" Watch "getCanonical, Absolute, Path in File" New topic

getCanonical, Absolute, Path in File

Ayman Jaffar
Ranch Hand

Joined: Sep 06, 2000
Posts: 57
Q: Consider a directory structure like this (NT or 95)
c:\JAVA\12345.msg --FILE
c:\JAVA\dir1\IO.class -- IO.class is under dir1
I don't understand the results of this code...And what does "..\\12345.msg" mean ?
public class IO {
public static void main(String args[]) {
File f = new File("..\\12345.msg"); //line (1)
}catch(IOException e){ System.out.println(e); }

Rong Chen
Ranch Hand

Joined: Aug 07, 2000
Posts: 30
"..\\12345.msg" means the file with name 12345.msg located on the parent direcotry of current directory. Here "\\" is necessary to express "\" in a string.
Does it help?
Ayman Jaffar
Ranch Hand

Joined: Sep 06, 2000
Posts: 57
You bet it helps. Thanks alot Rong Chen.
Have you checked out Aspose?
subject: getCanonical, Absolute, Path in File
It's not a secret anymore!