This example demonstrate how to create a file and how to revoke the write permission of the same file. The method createFile creates a file with a specified name and setWritable(false) revoke the write persmission.. The method canWrite() returns booleasn value which whether the file is write-able or not..
import java.io.File;
|
Note : Execution of this program will create a file with specified name with read-only attribute. You can also check the the file properties, by default it is read-only.

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.