• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java Bug? "new File(...)" deletes file?

b4u

Golden Member
Hi,

I'm using Eclipse 3.1 and have J2SDK 5.0 installed on my computer.

My question is:

When using the code:

import java.io.File;

String fileName = "c:/x/anyfile.txt";
File f = new File(fileName);

Instead of just creating an instance of File using the name I provided, the code just deletes it entirely from the disc ... any bug, or is there anything obvious I'm missing?

Thanks
 
I doubt that's happening, at least by the code that you posted - creating a File object in itself doesn't do anything.
 
AH! Found the code that was doing the dirty job!

Nothing better than take some time off, and return latter to find those difficult problems that are in front of our eyes and we just can't find ...

Better open my eyes at work lol

Thanks for listening 🙂
 
Back
Top