0% found this document useful (0 votes)
19 views

Files Command

The document demonstrates methods of the File class in Java like isFile(), getName(), canRead(), length(), mkdir(), getPath(), createNewFile(), isDirectory(), list() to check, create and list files and directories.

Uploaded by

Kabi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Files Command

The document demonstrates methods of the File class in Java like isFile(), getName(), canRead(), length(), mkdir(), getPath(), createNewFile(), isDirectory(), list() to check, create and list files and directories.

Uploaded by

Kabi
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

File ob=new File("/java","sample.

txt");
ob.isFile();
ob.getName();
ob.canRead();
ob.canWrite();
ob.length();
File obdir= new File("/java/md");
obdir.mkdir();
obdir.getName();
obdir.getPath();
File ob1=new File("/java/md","sample.txt");
ob1.createNewFile();
ob1.isDirectory();
String m[]=ob1.list();

for(int i=0;i<m.length();i++)
SOP("The file in directory ",m[i]);

File ob1= new File("/java/pgm");


File ob2= new File("/java/pgm", "sample.txt");
File ob3= new File(ob1, "sample.txt");

You might also like