Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

input file in java

public class GetFileInfo { 
  public static void main(String[] args) {
    File myObj = new File("filename.txt");
    if (myObj.exists()) {
      System.out.println("File name: " + myObj.getName());
      System.out.println("Absolute path: " + myObj.getAbsolutePath());
      System.out.println("Writeable: " + myObj.canWrite());
      System.out.println("Readable " + myObj.canRead());
      System.out.println("File size in bytes " + myObj.length());
    } else {
      System.out.println("The file does not exist.");
    }
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: fixed length array powershell 
Java :: java leap years 
Java :: difference between class and interface 
Java :: Quick Sort Java Implementation 
Java :: console java 
Java :: JsonArray get first Object 
Java :: java print 2d array as table 
Java :: basic java programs 
Java :: java list get first element 
Java :: System.out.printf("%"+(n)+"s ") 
Java :: print double without decimal java 
Java :: splay tree java implementation 
Java :: print statement in java 
Java :: android java textview weight programmatically 
Java :: selection sort java 
Java :: get spring application context 
Java :: get data from database sqlite android 
Java :: regular expression java 
Java :: array find max in java 
Java :: java multithreading 
Java :: how to use map, filter and reduce in Java 
Java :: loop array using stream java 
Java :: spring security after login redirect 
Java :: remove last node from linked list java 
Java :: flutter unable to find bundled java version 
Java :: java windowbuilder multiple monitors windowed mode 
Java :: pass a list of string as PathVariable to api spring boot 
Java :: how to call super onbackpressed in fragment 
Java :: locked screen android studio 
Java :: JAVA Character Literals 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =