I am a beginner and is given a project by my professor. I am in a process of making a console based game (Tetris) and want to implement controls to it for performing specific tasks i.e for movement and rotation. I have found out that KeyListener can be used but it is strictly GUI based. So I am looking for an alternate way to get the work done. If you have a solution or an article or web link related to it, it will be appreciated. Thanks!
Take a look at this thread, there are some solutions here: How to read a single char from the console in Java (as the user types it)?
To accomplish this you need to set your console into raw mode. Apparently there is no built-in way to do so with Java, but there are some libraries you could use to get there, like jCurses or jLine3.