File IsFile() Example
Tests whether the file denoted by this abstract pathname is a normal file
File class IsFile() method example. This example shows you how to use IsFile method.This method Tests whether the file denoted by this abstract pathname is a normal file
Here is the Code:-
/**
* @Program that Tests whether the file denoted by this abstract pathname is
* a normal file.
* IsFile.java
* Author:-RoseIndia Team
* Date:-30-May-2008
*/
import java.io.*;
public class IsFile {
public static void main(String[] args) {
File f = new File("/home/girish/Desktop/g.txt");
if (f.exists()) {
boolean b=f.isFile();
System.out.println("is File : " + b);
} else {
System.out.println("File does not exists");
}
}
} |
|