@@ -0,0 +1,1428 @@
+package com.yutax77.java8_ans.chap9;%0A%0Aimport java.io.Closeable;%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0Aimport java.nio.file.Paths;%0Aimport java.util.Scanner;%0A%0Apublic class Ans2 %7B%0A    public static void scanAndConvertToLowerCase(String srcPath, String outFileName) throws IOException %7B%0A        Scanner in = null;%0A        PrintWriter out = null;%0A%0A        try %7B%0A            in = new Scanner(Paths.get(srcPath));%0A            out = new PrintWriter(outFileName);%0A            while (in.hasNext()) %7B%0A                out.println(in.next().toLowerCase());%0A            %7D%0A        %7D catch (Exception e) %7B%0A            try %7B%0A                closeIfNotNull(in);%0A                in = null;%0A            %7D catch (IOException e1) %7B%0A                e.addSuppressed(e1);%0A            %7D%0A%0A            try %7B%0A                closeIfNotNull(out);%0A                out = null;%0A            %7D catch (IOException e2) %7B%0A                e.addSuppressed(e2);%0A            %7D%0A%0A            throw e;%0A        %7D finally %7B%0A            if (in != null) %7B%0A                try %7B%0A                    in.close();%0A                %7D finally %7B%0A                    if (out != null) %7B%0A                        out.close();%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A    private static %3CT extends Closeable%3E void closeIfNotNull(T closable) throws IOException %7B%0A        if (closable != null) %7B%0A            closable.close();%0A        %7D%0A    %7D%0A%7D%0A

Answer chap.9-2