Write a Java program to find the size of a specified fileSample Output:
/home/students/abc.txt : 0 bytes /home/students/test.txt : 0 byte
import java.util.Scanner; import java.io.File; public class Exercise45 { public static void main(String[] args) { System.out.println("/home/students/abc.txt : " + new File("abc.txt").length() + " bytes"); System.out.println("/home/students/test.txt : " + new File("test.txt").length() + " bytes"); } }
Sample Output:
/home/students/abc.txt : 0 bytes /home/students/test.txt : 0 bytes
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer