File a document creating the most basic example of record:
import java.io. *;
public class TestFile (
public static void main (String [] args)
(
String filename = "test.txt"; / / File Name
String directory = "testa / testb"; / / path name
File f = new File (directory, filename); / / Object File Structure
if (f.exists ())
(
System.out.println ( "File name:" + f.getAbsolutePath ());
System.out.println ( "File size:" + f.length ());
) else (
f.getParentFile (). mkdirs ();// create a series of path
try (
f.createNewFile ();
) catch (IOException e) (
e.printStackTrace ();
)
)
)
) |