文件内容的长度
类型 | 所占字节数 |
---|---|
中文符号 | 3字节 |
中文标点 | 3字节 |
英文符号 | 1字节 |
英文标点 | 1字节 |
代码如下:
import java.io.File;
/**
* @Author: Regulus
* @Date: 2022/11/15/12:37
* @Description:
*/
public class my2_4_length {
public void show(){
File f1_length_01 = new File("file\\Length1.txt");
File f1_length_02 = new File("file\\Length2.txt");
File f1_length_03 = new File("file\\Length3.txt");
File f1_length_04 = new File("file\\Length4.txt");
System.out.println("中文字符:"+f1_length_01.length());
System.out.println("中文标点:"+f1_length_02.length());
System.out.println("英文字符:"+f1_length_03.length());
System.out.println("英文标点:"+f1_length_04.length());
}
public static void main(String[] args) {
new my2_4_length().show();
}
}