Hello World
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/hello.png?resize=880%2C422&ssl=1)
写代码的流程
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/developing-1.png?resize=1024%2C274&ssl=1)
数组
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/array.png?resize=170%2C368&ssl=1)
初始化数组(Inline array initialization)
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/array-init.png?resize=1024%2C243&ssl=1)
常用的数组处理代码 Typical array-processing code
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/array-examples.png?resize=948%2C898&ssl=1)
二维数组Two-dimensional arrays
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/array2d.png?resize=316%2C482&ssl=1)
内联初始化Inline initialization
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/05/array2d-init.png?resize=482%2C504&ssl=1)
类Class/class
![](https://i0.wp.com/liuyandong.com/wp-content/uploads/2021/06/class.png?resize=900%2C1024&ssl=1)
文件
复制文件
public static void copyFile(File from, File to) throws IOException { File[] children = from.listFiles(); if (children == null || children.length == 0) { if (from.isDirectory()) { to.mkdirs(); } else { to.getParentFile().mkdirs(); Files.copy(from.toPath(), to.toPath(), StandardCopyOption.REPLACE_EXISTING); } } else { for (File child : children) { copyFile(child, new File(to, child.getName())); } } }
移动(move)文件
public static void moveFile(File from, File to) throws IOException { Files.move(from.toPath(), to.toPath(), StandardCopyOption.REPLACE_EXISTING); }
读文件
public static List<String> readLines(File file) throws IOException { List<String> lines = new ArrayList<String>(); try (BufferedReader br = new BufferedReader(new FileReader(file))) { String line = br.readLine(); while (line != null) { lines.add(line); line = br.readLine(); } } return lines; }