How do you determine what the main hard drive is?

This is what I have:

filename="savefile2.txt";

and this is pseudocode for what I want:

filename="MainDrive:/JavaProject/savefile2.txt";

My problem with it is, what if C: isn't the name of a person's hard drive? F:\ for instance. And also, if the folder name specified does not exist in their drive, is it automatically created?

EDIT:
I figured out I need to make the directory first

String directory="C:\\JavaProject\\";
	boolean success = new File(directory).mkdir();

Now how do I make the C:\ a general hard drive?

EDIT:
NEVERMIND I GOT IT lol.

String directory="\\Program Files\\JavaProject\\";
	boolean success = new File(directory).mkdir();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.