Categories
java

Writing code for the kids…

This evening I was having fun with Noah, my 5 yr old. He was rapid firing math questions at me. Stuff like daddy what is 10+10, 20+20, 40+40, etc. This went on for 5 minutes, and just when my head was starting to hurt Noah threw me a curveball. He asked what none+none was. Katie was quick to laugh off his question as silly and said that you can’t add none+none.

First I thought I was done with the math challenge, but I changed my mind and corrected Katie and said…. wrong mommy… you CAN add none+none. It’s called String concatenation. Noah was very interested in the idea of String concatenation so I fired up vi on my laptop and created this beauty in about 10 seconds to show him how to add words.

public class NoahStrings {
   public static void main(String[] args) {
      System.out.println("none" + "none");
      System.out.println();
   }
}

We spent a few minutes playing with different word combinations. I can say that was the first time I pair-programmed with a 5 yr old.

Leave a Reply

Your email address will not be published. Required fields are marked *