private String initConsoleAndGetAnswer ( ) { ConsoleReaderWrapper consoleReaderWrapper = initConsole ( ) ; String input = "" ; boolean valid = false ; while ( ! valid ) { input = consoleReaderWrapper . getInput ( ) ; valid = validate ( consoleReaderWrapper , input ) ; if ( ! valid ) { consoleReaderWrapper . print ( "" ) ; consoleReaderWrapper . print ( question ) ; } } consoleReaderWrapper . close ( ) ; return input ; }
Initialize console and get user input as answer