Sample Programs

Sample java program to get the file size


 package org.jusfortechies.example; 

 import java.io.File;
 
 public class GetFileSize {

   public static void main(String[] args) {
      
      File file = new File("C:\\samplefile.txt");
		
      // Get the file size in bytes. 
      long fileSize = file.length(); 

      // print file size 
      System.out.println("File size: " + fileSize); 

   }

 }




blog comments powered by Disqus