![]() |
In Java, you can create a file with specific File attributes such as read-only, hidden, or system attributes. This allows you to control the behavior and visibility of the file in the File system. In this article, we’ll explore how to create a file with specific attributes in Java. In this article, we will learn to create a file with a specific file attribute in Java. Syntax:To create a file with specific attributes in Java, we’ll use the java.nio.file.Files class specifically the setAttribute() method. Files.setAttribute(Path path, String attribute, Object value, LinkOption... options)
Program To Create a File with a Specific File Attribute in JavaHere’s how you can create a file with a read-only attribute in Java: Java
Output :The File created with read-only attribute.
Explanation of the above Program:
|
Reffered: https://www.geeksforgeeks.org
Java |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 11 |