Operation: Benji! The Postscript

*cough* Yes, dear readers, I promised that there would be no more Operation: Benji! posts, that I was over and done with writing about my failure programming. But! I just had to write one last one, because I just figured out how to write that SETI program. (The one that calculates the Drake Equation, not the duck one.)

See, apparently there’s this nifty class called a Scanner, which can read input from your keyboard. Say you wanted to write a program to hold a conversation with your computer* using the Scanner class. It would probably look something like this:

 

import java.util.Scanner;

public class IHaveNoLife {

public static void main(String[] args) {

                Scanner hello = new Scanner(System.in);

                System.out.print(“Enter thy name, minion: “);

                String s1 = hello.nextLine();

                System.out.println(“Greetings, puny slave of technology. I see you have found the keyboard. Well done. Anyway, your name is ” + s1 + “, isn’t it? Ho hum. You bore me, lesser being. I am going to leave now.”);

                                                                        }

 }

 

As you can probably tell from this exchange, my computer is extremely humble and submissive.

But anyway, the point is that I’ve learned how to use the Scanner class! Now I can write that SETI program! Then- well, actually, I haven’t really figured out what to do with it once it’s done. Possibly add some ducks.

 

*Actually, I suggest not doing this particular activity, because from my experience computers are extremely unstable, psychologically delicate creatures who are prone to nervous breakdowns which can only be cured by banana pudding.

Published
Categorized as Hacking

By Aditi Ramaswamy

I am Aditi Ramaswamy... the History Hacker. I like history, and hacking. Occasionally, I attempt to hack history itself. Sometimes it even works. Oh, and in my free time I also double as the state of Virginia (we really need a state fruit).