About 14,600,000 results
Open links in new tab
  1. File declaration in Java - Stack Overflow

    Oct 7, 2015 · Using the File class you can: Check if a file or directory exists. Create a directory if it does not exist. Read the length of a file. Rename or move a file. Delete a file. Check if path is …

  2. Java Files - W3Schools

    To use the File class, create an object of the class, and specify the filename or directory name: Example import java.io.File; // Import the File class File myObj = new File("filename.txt"); // …

  3. Java Program to Create a File with a Unique Name

    Apr 24, 2025 · In this article, we will learn two different solutions for creating a file with a unique name. Below are the different approaches for creating a file with a unique name in Java. Now …

  4. Writing file name in java - Stack Overflow

    Sep 25, 2014 · You need to create a String for the file name with the expected format. To do this, you can simply use the + operator which concatenates Strings (and automatically converts …

  5. Myth about the file name and class name in Java - GeeksforGeeks

    Feb 17, 2021 · The renameTo() method is a part of File class. The renameTo() function is used to rename the abstract path name of a File to a given path name. The function returns true if the …

  6. Java's File Names and Class Names - Blogger

    Jan 25, 2011 · Java is picky about the file names you use. Each source file can contain one public class. The source file's name has to be the name of that class. By convention, the source file …

  7. What is the best way to generate a unique and short file name in Java

    Well, you could use the 3-argument version: File.createTempFile(String prefix, String suffix, File directory) which will let you put it where you'd like. Unless you tell it to, Java won't treat it …

  8. File and Directory Names in Java: File, Path, Paths

    Nov 29, 2024 · You can construct file and directory names much more elegantly – completely without string operations, using the classes java.io.File and (from Java 7) java.nio.file.Path. …

    • Reviews: 18
    • File Handling in Java - GeeksforGeeks

      Jan 10, 2025 · In Java, with the help of File Class, we can work with files. This File Class is inside the java.io package. The File class can be used to create an object of the class and then …

    • File in Java | File Class, Example - Scientech Easy

      Feb 10, 2025 · File class in Java is an abstract representation of file and directory pathnames. It extends Object class and implements Serializable and Comparable<File> interfaces. The …

    • Some results have been removed
    Refresh