Code example for Console

Methods: readLine

0
	 
	public static String readLine(String userPrompt) throws IOException {
		String line = "";
		 
		if (console != null) {
			line = console.readLine(userPrompt);
		} else { 
			// print("console is null\n"); 
			BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
 
			print(userPrompt);
			line = bufferedReader.readLine();
		} 
		line.trim();
		return line;
	} 
}