I can read console input by:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String in = br.readLine();
The goal is to show last console input by pressing key "Up". When pressed console shows ^[[A
symbols. The code below does not detect when key "Up" is pressed:
switch (in) {
case "^[[A"://Key up.
//Do something - print previous input.
break;
//...
}
System.out.println(in);