File.setExecutable(boolean executable) has the following syntax.
public boolean setExecutable(boolean executable)
In the following code shows how to use File.setExecutable(boolean executable) method.
//ww w .ja va 2 s . 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.