
hi i have tried all the file methods to create a file inside a directory but none of them r working some of them are
new File ( ".", "C:/fileInRoot.txt" ) new File ( "myDir", "/otherDir" ) File( "myDir/OtherDir" ) File( "/OtherDir" ); new File ( "species/clan/individual.txt" )
can anyone help me

Java Create File
import java.io.*;
public class CreateFile{
public static void main(String[] args) throws IOException{
File f;
f=new File("C:/myfile.txt");
if(!f.exists()){
f.createNewFile();
System.out.println("New file has been created inside the C folder);
}
}
}

package com.lara; import java.io.File; import java.io.IOException;
public class G { public static void main(String[] args) { File f1 = new File("E:/Notes/pqr.txt"); System.out.println(f1.exists());
try
{
boolean b = f1.createNewFile();
}
catch(Exception ex)
{
System.out.println(ex);
}
} }