集册 Java实例教程 获取文件大小

获取文件大小

欢马劈雪     最近更新时间:2020-01-02 10:19:05

396
获取文件大小

import java.io.File;
/** 来 自 时 代 J a v a - N o w J a v a . c o m**/

public class Main {


  public void main(String[] argv) {

    File file = new File("infilename");


    // Get the number of bytes in the file

    long length = file.length();

  }

}