Let’s face it, life isn’t worth living most days. What can you do about it? I’m afraid you can’t do much. It will cause you to try and escape from reality and then where will you be? Crushed without a place to go. Yeah, that’s the kind of consequences I’m talking about most of the time. So, why bother with it all? I’m not sure why I do most days. Wouldn’t it be easier to off myself? I mean who hasn’t thought about killing themselves from time to time? I know I have. It would be nice not to have these thoughts and feelings about my life. But I do have them and they won’t go away. So I must deal with them. There’s nothing wrong with that, I guess? Maybe there is. I don’t know for sure. So just allow it to be whatever it wants to be. If life wants me dead, who am I to argue with it? There’s so many things in this life that don’t matter. So many things in this life that do matter. I need to find a balance in between the two things and make it work out for me.
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