读取以列表形式返回的文件的所有行
import java.io.IOException;/** from 时代Java - nowjava.com**/ import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; public class Main { public static void main(String[] args) throws IOException { try { Path path = Paths.get("/home/docs/users.txt"); List<String> contents = Files.readAllLines(path, Charset.defaultCharset()); for (String b : contents) {