Tool Time Home Entry Chatlog Stooge Antics
Tool Time Entry #6  •  Three Stooges Driver  •  11/01/2026

TNT Tool Time — Entry #6 — Java Driver Class

Three Stooges Driver

Nyuk nyuk nyuk — it’s Java this time.
A lean 10-line driver class, one deliberate bug, and a whole lot of room to improve. Copy it. Fix it. Use AI to take it somewhere worthy of Moe, Larry, and Curly.

☕  Tool Time Entry #6 — First Java-Only Entry

Moe, Larry & Curly Walk Into a Java Class…

TechToolsGuru wrote this deliberately lean Java driver class to showcase how command-line arguments work in Java — and to give APCS novices a real starting point they can vibe-code into something more interesting. The Stooges are named via args[0], args[1], and args[2], which come from whatever you type after the class name when you run it.

This is Tool Time’s first Java-only entry — no p5.js, no canvas. Just pure Java. Copy it, paste it into JDoodle, and try to run it. (Hint: it won’t compile immediately. Spot why.)

Heads Up — There Is a Style Issue on Line 6!
Look carefully: System. out.println has a space between System. and out. Java’s specification allows whitespace between tokens, so modern compilers (including JDoodle and CodeHS) will run this without complaint. But it is poor style — a human reader will do a double-take, and a strict linter or code reviewer would flag it immediately. Finding it and removing the space is a good first exercise in reading code carefully.
    By TechToolsGuru (KLP) •  Java Driver Class •  10 lines Original source — space on line 6 preserved as written

    Your Turn — The Five-Stage Adventure

    Hit Copy above, paste into JDoodle. Each stage below hands you a problem. Solve it. See what new problem that creates. Repeat. That is exactly how real Java developers work.

    💻 Stage 1 — Run It in JDoodle

    The code uses args[0], args[1], args[2]. JDoodle has an “Input arguments” field below the code editor — type Moe Larry Curly into it and click Run. The code works exactly as written. First lesson: read the tool’s interface before assuming something won’t work.

    🧠 Understand the Signature

    Before going further, make sure you can explain every word of this line:

    public static void main(String[] args)
    • public — any other class (including the JVM) can call this method.
    • static — the JVM calls main without creating a ThreeStoogesDriver object first. No new needed.
    • void — returns nothing.
    • main — the magic name the JVM looks for as the entry point.
    • String[] args — an array of Strings passed from the command line (or the “Input arguments” field). args[0] is the first word.

    ⚠️ Stage 2 — What If There Is No Args Field?

    Many classroom environments (certain IDEs, AP Classroom, CodeHS) have no way to pass command-line arguments. Run the code without filling in the args field. You will see an ArrayIndexOutOfBoundsException — a crash, not a style issue. Ask your AI assistant:

    You are a patient APCS Java teacher. My Three Stooges Driver crashes
    with ArrayIndexOutOfBoundsException when no arguments are provided.
    Add a fallback: if args.length < 3, use hardcoded names "Moe", "Larry",
    "Curly". If args are provided, use them. Show the complete updated class
    with comments explaining the change.

    🧹 Stage 3 — Bridge args[] into an ArrayList

    Shemp Howard was the fourth Stooge. Try adding him as String stooge4 = args[3]. The print line needs updating. Add a fifth (Joe Besser)? Parallel variables multiply fast. Instead, keep your args[] exactly as it is and bridge it into a dynamic ArrayList using a for-each loop:

    import java.util.ArrayList;
    
    ArrayList<String> stooges = new ArrayList<String>();
    
    // Populate the AL from the args array — bridge: fixed array → dynamic list
    for (String name : args) {
        stooges.add(name);
    }
    
    // Now add stooges beyond what args[] could hold:
    stooges.add("Shemp");
    System.out.println("The stooges are: " + stooges);

    This pattern is the key relationship between primitive arrays and ArrayLists: args[] is fixed in size and given to you by the runtime — you cannot grow it. ArrayList is dynamic — you can keep adding. The for-each loop is the bridge.

    📤 Stage 3b — Printing: Arrays vs ArrayLists vs Custom Methods

    Before moving on, try printing both structures and compare the output:

    System.out.println(args);     // ← try this first — surprising!
    System.out.println(stooges);  // ← then this

    println(args) prints something like [Ljava.lang.String;@6d06d69c — a memory address, not the contents. Arrays in Java do not override the default toString() method, so Java prints the type ([L = array of objects, java.lang.String) and the object’s memory location. ArrayList, however, does override toString() and prints its contents: [Moe, Larry, Curly, Shemp].

    For full control — one name per line, numbered, formatted how you want — write a static helper method:

    public static void printArrayList(ArrayList<String> list) {
        for (int i = 0; i < list.size(); i++) {
            System.out.println((i + 1) + ". " + list.get(i));
        }
    }
    
    // In main, call it:
    printArrayList(stooges);

    Output: 1. Moe   2. Larry   3. Curly   4. Shemp — one per line, numbered. Note that list.get(i) retrieves an ArrayList element by index, just as args[i] does for an array. If you want to print the array nicely without a loop, Java’s built-in Arrays.toString(args) works — but you have to import java.util.Arrays first.

    ⛔ Stage 4 — No Duplicates

    Try adding Moe twice. The ArrayList allows it: [Moe, Larry, Curly, Moe]. There is only one Moe. Fix it with a guard:

    if (!stooges.contains(candidate)) {
        stooges.add(candidate);
    } else {
        System.out.println(candidate + " is already in the list!");
    }

    🔤 Stage 5 — Case Sensitivity

    Now try adding "moe" (lowercase). .contains("moe") returns false — Java’s equals() is case-sensitive. Your duplicate guard fails. Ask your AI to normalize names before checking so that "MOE", "moe", and "Moe" are all treated the same. Hint: toLowerCase() and toUpperCase().

    💻 Run args in JDoodle ⚠️ args fallback / Scanner 📜 Switch to ArrayList ⛔ No-duplicate guard 🔤 Case normalization 🧹 Add Shemp & Joe 📊 Sort the roster 📦 Build a Stooge class

    Need Stooge inspiration? Check out the TNT Legacy Thanksgiving movie clips page — it features some classic Three Stooges antics. There’s also Swingin’ the Alphabet, where the Stooges accidentally demonstrate a nested loop.

    🔧 C.R.A.F.T. every ask. Context: “I have a Three Stooges Java driver class [describe what it currently does]”; Role: “Act as a patient APCS Java teacher”; Action: name the exact stage you’re on (add fallback / switch to ArrayList / add duplicate guard / normalize case); Form: “Show the complete updated class with comments”; Tight: “Keep it under 40 lines; preserve the Stooges theme.”
    Full C.R.A.F.T. breakdown at Tool Time Home ↓