I don't know. What's wrong with that? (Please tell us if the code doesn't compile, or if it doesn't work; and in either case tell us what error message you're seeing. At first glance the code looks fine.)
At first glance the code looks fine, unless this code doesn't reside in a code block aside from a class code block. Outside of a code block, you cannot do simple variable assignments separated from variable declarations (though, I seem to recall that compound assignments are ok). So, the last line - success = oldFile.renameTo( newFile ); - would cause a compiler error.
Well, let's see. I'm not a Windows person, so I can't comment on whether Java interprets the "C:\" drive specifier properly as a directory; I'll assume it does. One possibility: the file's name isn't actually A.jpeg, but A.jpg. Don't those file extensions have to be 3 characters? Have a close look at the file and let us know.
Joined: Dec 10, 2001
Don't those file extensions have to be 3 characters? Not sense pre-Windows 95.