Java File.setExecutable(boolean executable)
Syntax
File.setExecutable(boolean executable) has the following syntax.
public boolean setExecutable(boolean executable)
Example
In the following code shows how to use File.setExecutable(boolean executable) method.
/*from w w w.j a v a2s.c o m*/
import java.io.File;
public class Main {
public static void main(String[] args) {
File f = new File("test.txt");
boolean bool = f.setExecutable(true);
System.out.println("setExecutable() succeeded?: " + bool);
bool = f.canExecute();
System.out.print("Can execute?: " + bool);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »