Aktive lesere: 6

Lokale meninger, globale ytringer

Java Console

During my time as a student I often needed a way to get console input. Often the tasks we were given to solve only involved console and thus no need for GUI solutions. The teacher himself had a pre-defined package that we could use, though I found it lacked some features I wanted. Features like being able to date-stamp the output, send in default values that it would read from the console input, things like that. The code itself is old, from 2005 – though I figured that it would still be useful when I earlier today assisted a friend of mine whom currently undertakes the same education that I once did.

The console will listen for input until you enter the «magical» exit word. With the sample the exit word has been set to «quit». The java console application comes with a test application so that you can quickly test it. You can easily change this to only listen for input once by removing the do/while loop that is wrapped around it. Nothing fancy, but still useful.

Anbefalte lenker
Aktivitet