Here you can find the source of close(final Scanner scanner)
public static void close(final Scanner scanner)
//package com.java2s; //License from project: Apache License import java.io.Closeable; import java.io.IOException; import java.util.Scanner; public class Main { public static void close(final Scanner scanner) { if (scanner != null) { scanner.close();/*from w w w . java 2s . c o m*/ } } public static IOException close(final Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (final IOException e) { e.printStackTrace(); return e; } } return null; } }