浏览代码

new changes

Xcuello 5 年前
父节点
当前提交
08422819c1
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1
    3
      src/main/java/HamletParser.java

+ 1
- 3
src/main/java/HamletParser.java 查看文件

22
 
22
 
23
         File file = new File(classLoader.getResource("hamlet.txt").getFile());
23
         File file = new File(classLoader.getResource("hamlet.txt").getFile());
24
 
24
 
25
-        StringBuilder result = new StringBuilder("");
25
+        StringBuilder result = new StringBuilder();
26
 
26
 
27
         try(Scanner scanner = new Scanner(file)){
27
         try(Scanner scanner = new Scanner(file)){
28
 
28
 
33
                 result.append(line).append("\n");
33
                 result.append(line).append("\n");
34
             }
34
             }
35
 
35
 
36
-            scanner.close();
37
-
38
         }catch(IOException e){
36
         }catch(IOException e){
39
 
37
 
40
             e.printStackTrace();
38
             e.printStackTrace();