Okay, okay. So…what happened to Lex? Did Lex die? He and Clark went down in the huge ice/crystal Fortress of Solitude thing as it collapsed all around them and then what? Season Eight starts and there’s no Lex! What happened to Lex? I had to google it, and the actor wanted to pursue other things in his career, a noble choice, and they brought in this Tess Mercer chick? What the hell is going on with her?! I want Lex back! I mean, first Lionel, now Lex? WTF man?! Why is this happening? I get it, shows that last for a while they tend to fizzle out every now and then and it’s time to bring in new blood into the family. But seriously? Lex? Lex Luthor? He’s Superman’s arch enemy! You can’t kill the guy! Can you?! If they did kill him, then I guess he’s dead. Gone. Kaput! But come on now. WTF mate?!
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