Thu Jun 4 02:05:29 PM MDT 2026 Well, today is another day. It would be nice to be able to understand this stress and anxiety I have been facing. It’s been going on for far too long. I need it to stop, or find a way to make it stop. Some medication can help from time to time, but I don’t want to be reliant on that medication every single day. I don’t know, maybe there’s no way to get around that thought process? Not sure. Not sure I ever know what this life is all about with these challenges I face on a day-to-day basis. Easier than it sounds, right? Yeah…that’s what I’ve been thinking. Too many damn thoughts in my mind at times. I’m not sure what to do with them all. Some are out to get me, I fear. I can’t let them win though. They need to stay the hell away from me! Life has its ups and downs, no one can argue that point. It’s not meant to be a terrible place to live in, but if I can’t figure it out? What am I supposed to do about it? I don’t know. Thu Jun 04 02:21:33 PM MDT 2026...
Ah the fun times of inputting data from the command line in a Java program.
Java has come a long way in this respect. From starting with IO Streams to what they have now. Currently, there is a Console class in the java.io package. Here's a simple test I did capturing data the user enters:
import java.io.Console;
import java.io.IOException;
public class Test {
public Test() {
}
public static void main(String[] args) throws IOException {
String in = null;
Console c = System.console();
if (c == null) {
System.err.println("No console.");
System.exit(1);
}
while (!(in = c.readLine("> ")).equals(".quit")) {
// do something with the content you just captured
System.out.println(in);
}
}
}
That's a very simple program now isn't it? Just accepts whatever you enter and echos it back out to the screen. If you type in .quit it will quit the program.
So yep, just a simple program for capturing data in a Console application.
Comments
Post a Comment