This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Originally posted by Warren Dew: I'm getting some behavior from java.io.File that seems to me strange:
So does the empty file descriptor (File("")) represent the current working directory, or not? What am I missing?
I'm a little confused by your code. In the last line, I see a variable named directory. However, you didn't post it's declaration or initialization.
I suspect that the first few lines of code are referencing a file named "" in the current working directory. Since the file has a blank name, you don't see it when you print out the absolute path. To get just the current working directory, you should use ".". Most modern operating systems use this convention.