Chapter 13 Java input and output

CSDN Q & A 2022-02-13 06:52:08 阅读数:644

chapter java input output

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class FileTest {
public static void main(String[] args) throws IOException {
// Please be there. Begin-End Write complete code between
/********** Begin **********/
// Receive the given string ( Catalog )

 // Traverse the directory , Output the minimum and maximum file names and their sizes /********** End **********/}

}




Take the answer :

File file=new File(“ Directory name ”);
File[] files = file.listFiles();
Traverse files,file Object has file name and file size . Just judge the output .



Other answers 2:

Put the file name and file size into the collection Dictionary , Sort by file size .

copyright:author[CSDN Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130652070373.html