Here you can find the source of readLine(String fmt, Object... args)
public static String readLine(String fmt, Object... args)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; public class Main { public static String readLine() { java.io.Console console = System.console(); if (console != null) { return System.console().readLine(); } else {/*from w w w .j a v a 2 s . c o m*/ try { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); return buffer.readLine(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } } public static String readLine(String fmt, Object... args) { java.io.Console console = System.console(); if (console != null) { return System.console().readLine(fmt, args); } else { print(fmt, args); try { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); return buffer.readLine(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } } public static void print(String text, Object... args) { printf(System.out, text, args); } public static void printf(PrintStream stream, String text, Object... args) { stream.printf(text, args); } }