R
R
roman38472014-05-04 13:09:33
Java
roman3847, 2014-05-04 13:09:33

How to create a file in a folder?

The folder is located along the path Path.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
overmes, 2014-05-04
@overmes

Files in folders are not created, they need to be put there.

Y
yurnei, 2014-05-05
@yurnei

Try this:
File file2=new File("d:\\kamal\\Nayan.txt");
file2.mkdirs();
try {
file2.createNewFile();
} catch (IOException e) {
System. out. println("Unable to create the file. Please create it manually.");
}
System.out.println(file2.exists());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question